class Rollbar::Delay::SuckerPunch

Attributes

perform_proc[RW]
ready[RW]

Public Class Methods

call(payload) click to toggle source
# File lib/rollbar/delay/sucker_punch.rb, line 27
def self.call(payload)
  setup unless ready

  perform_proc.call(payload)
end
setup() click to toggle source
# File lib/rollbar/delay/sucker_punch.rb, line 15
def self.setup
  major_version = ::SuckerPunch::VERSION.split.first.to_i

  self.perform_proc = if major_version > 1
                        proc { |payload| perform_async(payload) }
                      else
                        proc { |payload| new.async.perform(payload) }
                      end

  self.ready = true
end

Public Instance Methods

perform(*args) click to toggle source
# File lib/rollbar/delay/sucker_punch.rb, line 33
def perform(*args)
  Rollbar.process_from_async_handler(*args)

  # SuckerPunch can configure an exception handler with:
  #
  # SuckerPunch.exception_handler { # do something here }
  #
  # This is just passed to Celluloid.exception_handler which will
  # push the reiceved block to an array of handlers, by default empty, [].
  #

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