Sha256: c3c440dc50f97e5adcbd4572e4151ebc31f22e166c897f5442b8ecf4a5112eb1

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

# encoding: utf-8

module HireFire
  class Configuration

    ##
    # Contains the max amount of workers that are allowed to run concurrently
    #
    # @return [Fixnum] default: 1
    attr_accessor :max_workers

    ##
    # Contains the min amount of workers that should always be running
    #
    # @return [Fixnum] default: 0
    attr_accessor :min_workers

    ##
    # Contains the job/worker ratio which determines
    # how many workers need to be running depending on
    # the amount of pending jobs
    #
    # @return [Array] containing one or more hashes
    attr_accessor :job_worker_ratio

    ##
    # 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.
    #
    # @param [Symbol, nil] environment Contains the name of the environment to run in.
    # @return [Symbol, nil] default: nil
    attr_accessor :environment

    ##
    # Instantiates a new HireFire::Configuration object
    # with the default configuration. These default configurations
    # may be overwritten using the HireFire.configure class method
    #
    # @return [HireFire::Configuration]
    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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hirefire-0.1.4 lib/hirefire/configuration.rb
hirefire-0.1.3 lib/hirefire/configuration.rb
hirefire-0.1.2 lib/hirefire/configuration.rb