Class: Rollbar::Delay::Sidekiq

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/rollbar/delay/sidekiq.rb

Constant Summary collapse

OPTIONS =
{ 'queue' => 'rollbar', 'class' => Rollbar::Delay::Sidekiq }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Sidekiq

Returns a new instance of Sidekiq.



8
9
10
# File 'lib/rollbar/delay/sidekiq.rb', line 8

def initialize(*args)
  @options = (opts = args.shift) ? OPTIONS.merge(opts) : OPTIONS
end

Instance Method Details

#call(payload) ⇒ Object



12
13
14
# File 'lib/rollbar/delay/sidekiq.rb', line 12

def call(payload)
  ::Sidekiq::Client.push @options.merge('args' => [payload])
end

#perform(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/rollbar/delay/sidekiq.rb', line 18

def perform(*args)
  begin
    Rollbar.process_from_async_handler(*args)
  rescue
    # Raise the exception so Sidekiq can track the errored job
    # and retry it
    raise
  end
end