Class: HireFire::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/hirefire/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHireFire::Configuration

Instantiates a new HireFire::Configuration object with the default configuration. These default configurations may be overwritten using the HireFire.configure class method



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/hirefire/configuration.rb', line 40

def initialize
  @max_workers      = 1
  @min_workers      = 0
  @job_worker_ratio = [
      { :jobs => 1,   :workers => 1 },
      { :jobs => 25,  :workers => 2 },
      { :jobs => 50,  :workers => 3 },
      { :jobs => 75,  :workers => 4 },
      { :jobs => 100, :workers => 5 }
    ]
end

Instance Attribute Details

#environmentSymbol?

Default is nil, in which case it’ll auto-detect either :heroku or :noop, depending on the environment. It will never use :local, unless explicitly defined by the user.

Parameters:

  • environment (Symbol, nil)

    Contains the name of the environment to run in.

Returns:

  • (Symbol, nil)

    default: nil



32
33
34
# File 'lib/hirefire/configuration.rb', line 32

def environment
  @environment
end

#job_worker_ratioArray

Contains the job/worker ratio which determines how many workers need to be running depending on the amount of pending jobs

Returns:

  • (Array)

    containing one or more hashes



24
25
26
# File 'lib/hirefire/configuration.rb', line 24

def job_worker_ratio
  @job_worker_ratio
end

#max_workersFixnum

Contains the max amount of workers that are allowed to run concurrently

Returns:

  • (Fixnum)

    default: 1



10
11
12
# File 'lib/hirefire/configuration.rb', line 10

def max_workers
  @max_workers
end

#min_workersFixnum

Contains the min amount of workers that should always be running

Returns:

  • (Fixnum)

    default: 0



16
17
18
# File 'lib/hirefire/configuration.rb', line 16

def min_workers
  @min_workers
end