Module: SidekiqSimpleDelay::DelayMethods

Defined in:
lib/sidekiq_simple_delay/delay_methods.rb

Overview

Aliased class methods to be added to Class

Instance Method Summary collapse

Instance Method Details

#simple_sidekiq_delay(options = {}) ⇒ Object Also known as: simple_delay

Immediately enqueue a job to handle the delayed action

Parameters:

  • options (Hash) (defaults to: {})

    options similar to Sidekiq's `perform_async`



12
13
14
# File 'lib/sidekiq_simple_delay/delay_methods.rb', line 12

def simple_sidekiq_delay(options = {})
  Proxy.new(SimpleDelayedWorker, self, options)
end

#simple_sidekiq_delay_for(interval, options = {}) ⇒ Object Also known as: simple_delay_for

Enqueue a job to handle the delayed action after an elapsed interval

Parameters:

  • interval (#to_f)

    Number of seconds to wait. `to_f` will be called on this argument to convert to seconds.

  • options (Hash) (defaults to: {})

    options similar to Sidekiq's `perform_in`



21
22
23
# File 'lib/sidekiq_simple_delay/delay_methods.rb', line 21

def simple_sidekiq_delay_for(interval, options = {})
  Proxy.new(SimpleDelayedWorker, self, options.merge('at' => Time.now.to_f + interval.to_f))
end

#simple_sidekiq_delay_until(timestamp, options = {}) ⇒ Object Also known as: simple_delay_until

Enqueue a job to handle the delayed action after at a certain time

Parameters:

  • timestamp (#to_f)

    Timestamp to execute job at. `to_f` will be called on this argument to convert to a timestamp.

  • options (Hash) (defaults to: {})

    options similar to Sidekiq's `perform_at`



30
31
32
# File 'lib/sidekiq_simple_delay/delay_methods.rb', line 30

def simple_sidekiq_delay_until(timestamp, options = {})
  Proxy.new(SimpleDelayedWorker, self, options.merge('at' => timestamp.to_f))
end