Class: Rollbar::Delay::SuckerPunch
- Inherits:
-
Object
- Object
- Rollbar::Delay::SuckerPunch
- Includes:
- SuckerPunch::Job
- Defined in:
- lib/rollbar/delay/sucker_punch.rb
Class Attribute Summary collapse
-
.perform_proc ⇒ Object
Returns the value of attribute perform_proc.
-
.ready ⇒ Object
Returns the value of attribute ready.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.perform_proc ⇒ Object
Returns the value of attribute perform_proc.
10 11 12 |
# File 'lib/rollbar/delay/sucker_punch.rb', line 10 def perform_proc @perform_proc end |
.ready ⇒ Object
Returns the value of attribute ready.
10 11 12 |
# File 'lib/rollbar/delay/sucker_punch.rb', line 10 def ready @ready end |
Class Method Details
.call(payload) ⇒ Object
27 28 29 30 31 |
# File 'lib/rollbar/delay/sucker_punch.rb', line 27 def self.call(payload) setup unless ready perform_proc.call(payload) end |
.setup ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# 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 |
Instance Method Details
#perform(*args) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# 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 |