class Sidekiq::Throttled::Config
Configuration object.
Attributes
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.
@return [Float, nil]
Amount of throttled jobs returned from the queue subsequently after which queue will be excluded from polling for the durations of {#cooldown_period}.
@return [Integer]
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: {with: `:enqueue`}
@return [Hash]
Public Class Methods
Public Instance Methods
Source
# File lib/sidekiq/throttled/config.rb, line 37 def cooldown_period=(value) raise TypeError, "unexpected type #{value.class}" unless value.nil? || value.is_a?(Float) raise ArgumentError, "period must be positive" unless value.nil? || value.positive? @cooldown_period = value end
@!attribute [w] cooldown_period
Source
# File lib/sidekiq/throttled/config.rb, line 45 def cooldown_threshold=(value) raise TypeError, "unexpected type #{value.class}" unless value.is_a?(Integer) raise ArgumentError, "threshold must be positive" unless value.positive? @cooldown_threshold = value end
@!attribute [w] cooldown_threshold
Source
# File lib/sidekiq/throttled/config.rb, line 53 def default_requeue_options=(options) requeue_with = options.delete(:with)&.to_sym || :enqueue @default_requeue_options = options.merge({ with: requeue_with }) end
@!attribute [w] default_requeue_options
Source
# File lib/sidekiq/throttled/config.rb, line 59 def reset! @cooldown_period = 1.0 @cooldown_threshold = 100 @default_requeue_options = { with: :enqueue } end