Class: Sidekiq::Throttled::Config
- Inherits:
-
Object
- Object
- Sidekiq::Throttled::Config
- Defined in:
- lib/sidekiq/throttled/config.rb
Overview
Configuration object.
Instance Attribute Summary collapse
-
#cooldown_period ⇒ Float?
Period in seconds to exclude queue from polling in case it returned #cooldown_threshold amount of throttled jobs in a row.
-
#cooldown_threshold ⇒ Integer
Amount of throttled jobs returned from the queue subsequently after which queue will be excluded from polling for the durations of #cooldown_period.
-
#default_requeue_options ⇒ Hash
Specifies how we should return throttled jobs to the queue so they can be executed later.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
32 33 34 |
# File 'lib/sidekiq/throttled/config.rb', line 32 def initialize reset! end |
Instance Attribute Details
#cooldown_period ⇒ Float?
Period in seconds to exclude queue from polling in case it returned #cooldown_threshold amount of throttled jobs in a row.
Set this to ‘nil` to disable cooldown completely.
13 14 15 |
# File 'lib/sidekiq/throttled/config.rb', line 13 def cooldown_period @cooldown_period end |
#cooldown_threshold ⇒ Integer
Amount of throttled jobs returned from the queue subsequently after which queue will be excluded from polling for the durations of #cooldown_period.
20 21 22 |
# File 'lib/sidekiq/throttled/config.rb', line 20 def cooldown_threshold @cooldown_threshold end |
#default_requeue_options ⇒ Hash
Specifies how we should return throttled jobs to the queue so they can be executed later. Expects a hash with keys that may include :with and :to For :with, options are ‘:enqueue` (put them on the end of the queue) and `:schedule` (schedule for later). For :to, the name of a sidekiq queue should be specified. If none is specified, jobs will by default be requeued to the same queue they were originally enqueued in. Default: `:enqueue`
30 31 32 |
# File 'lib/sidekiq/throttled/config.rb', line 30 def @default_requeue_options end |
Instance Method Details
#reset! ⇒ Object
59 60 61 62 63 |
# File 'lib/sidekiq/throttled/config.rb', line 59 def reset! @cooldown_period = 1.0 @cooldown_threshold = 100 @default_requeue_options = { with: :enqueue } end |