Class: Sidekiq::Throttled::Configuration
- Inherits:
-
Object
- Object
- Sidekiq::Throttled::Configuration
- Defined in:
- lib/sidekiq/throttled/configuration.rb
Overview
Configuration holder.
Instance Method Summary collapse
-
#inherit_strategies=(value) ⇒ Object
Instructs throttler to lookup strategies in parent classes, if there’s no own strategy:.
-
#inherit_strategies? ⇒ Boolean
Whenever throttled workers should inherit parent’s strategies or not.
-
#initialize ⇒ Configuration
constructor
Class constructor.
-
#reset! ⇒ self
Reset configuration to defaults.
Constructor Details
#initialize ⇒ Configuration
Class constructor.
8 9 10 |
# File 'lib/sidekiq/throttled/configuration.rb', line 8 def initialize reset! end |
Instance Method Details
#inherit_strategies=(value) ⇒ Object
Instructs throttler to lookup strategies in parent classes, if there’s no own strategy:
class Foo
include Sidekiq::Worker
include Sidekiq::Worker::Throttled
sidekiq_throttle :concurrency => { :limit => 42 }
end
class Bar < Foo
end
By default in the example above, ‘Bar` won’t have throttling options. Set this flag to ‘true` to enable this lookup in initializer, after that `Bar` will use `Foo` throttling bucket.
37 38 39 |
# File 'lib/sidekiq/throttled/configuration.rb', line 37 def inherit_strategies=(value) @inherit_strategies = value ? true : false end |
#inherit_strategies? ⇒ Boolean
Whenever throttled workers should inherit parent’s strategies or not. Default: ‘false`.
45 46 47 |
# File 'lib/sidekiq/throttled/configuration.rb', line 45 def inherit_strategies? @inherit_strategies end |
#reset! ⇒ self
Reset configuration to defaults.
15 16 17 18 19 |
# File 'lib/sidekiq/throttled/configuration.rb', line 15 def reset! @inherit_strategies = false self end |