class Honeybadger::Plugins::Shoryuken::Middleware
Public Instance Methods
call(_worker, _queue, sqs_msg, body) { || ... }
click to toggle source
# File lib/honeybadger/plugins/shoryuken.rb, line 8 def call(_worker, _queue, sqs_msg, body) begin yield rescue => e if attempt_threshold <= receive_count(sqs_msg) Honeybadger.notify(e, parameters: notification_params(body)) end raise e end ensure Honeybadger.clear! end
Private Instance Methods
attempt_threshold()
click to toggle source
# File lib/honeybadger/plugins/shoryuken.rb, line 24 def attempt_threshold ::Honeybadger.config[:'shoryuken.attempt_threshold'].to_i end
notification_params(body)
click to toggle source
# File lib/honeybadger/plugins/shoryuken.rb, line 34 def notification_params(body) body.is_a?(Array) ? { batch: body } : { body: body } end
receive_count(sqs_msg)
click to toggle source
# File lib/honeybadger/plugins/shoryuken.rb, line 28 def receive_count(sqs_msg) return 0 if sqs_msg.is_a?(Array) sqs_msg.attributes['ApproximateReceiveCount'.freeze].to_i end