Module: Resque::Plugins::Director::Config
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :min_workers => 1, :max_workers => 0, :max_time => 0, :max_queue => 0, :wait_time => 60, :start_override => nil, :stop_override => nil, :logger => nil, :log_level => :debug, :no_enqueue_scale => false }
Instance Attribute Summary collapse
-
#queue ⇒ Object
Returns the value of attribute queue.
Instance Method Summary collapse
Instance Attribute Details
#queue ⇒ Object
Returns the value of attribute queue.
7 8 9 |
# File 'lib/resque/plugins/director/config.rb', line 7 def queue @queue end |
Instance Method Details
#log(message) ⇒ Object
29 30 31 |
# File 'lib/resque/plugins/director/config.rb', line 29 def log() @logger.send(@log_level, "DIRECTORS LOG: #{}") if @logger end |
#reset! ⇒ Object
22 23 24 25 26 27 |
# File 'lib/resque/plugins/director/config.rb', line 22 def reset! DEFAULT_OPTIONS.each do |key, default| attr_reader key self.instance_variable_set("@#{key.to_s}", default) end end |
#setup(options = {}) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/resque/plugins/director/config.rb', line 33 def setup(={}) DEFAULT_OPTIONS.each do |key, value| self.instance_variable_set("@#{key.to_s}", [key] || value) end @min_workers = 0 if @min_workers < 0 @max_workers = DEFAULT_OPTIONS[:max_workers] if @max_workers < @min_workers end |