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

Raises:

  • (StandardError)


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

def call(payload)
  return unless ::Sidekiq::Client.push(@options.merge('args' => [payload])).nil?

  raise(StandardError, 'Unable to push the job to Sidekiq')
end

#perform(*args) ⇒ Object



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

def perform(*args)
  Rollbar.process_from_async_handler(*args)

  # Do not rescue. Sidekiq will call the error handler.
end