Module: Sidekiq::Throttled::Job

Defined in:
lib/sidekiq/throttled/job.rb

Overview

Adds helpers to your worker classes

Examples:

Usage


class MyJob
  include Sidekiq::Job
  include Sidekiq::Throttled::Job

  sidkiq_options :queue => :my_queue
  sidekiq_throttle :threshold => { :limit => 123, :period => 1.hour },
                   :requeue => { :to => :other_queue, :with => :schedule }

  def perform
    # ...
  end
end

See Also:

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

VALID_VALUES_FOR_REQUEUE_WITH =
%i[enqueue schedule].freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Note:

Using ‘included` hook with extending worker with ClassMethods in order to make API inline with `include Sidekiq::Job`.

Extends worker class with ClassMethods.



35
36
37
38
# File 'lib/sidekiq/throttled/job.rb', line 35

def self.included(base)
  base.sidekiq_class_attribute :sidekiq_throttled_requeue_options
  base.extend(ClassMethods)
end