Skip to content

Commit

Permalink
error logging to allow knowledge of what the failure was before retrying
Browse files Browse the repository at this point in the history
  • Loading branch information
rwadstein committed May 15, 2017
1 parent e331de9 commit f92a858
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/shoryuken/middleware/server/exponential_backoff_retry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ def call(worker, queue, sqs_msg, body)

started_at = Time.now
yield
rescue
rescue => ex
logger.info { "Message #{sqs_msg.message_id} will attempt retry due to error: #{ex.message}" }

retry_intervals = worker.class.get_shoryuken_options['retry_intervals']

if retry_intervals.nil? || !handle_failure(sqs_msg, started_at, retry_intervals)
# Re-raise the exception if the job is not going to be exponential backoff retried.
# This allows custom middleware (like exception notifiers) to be aware of the unhandled failure.
raise
end

# since we didn't raise, lets log the backtrace for debugging purposes.
logger.debug { ex.backtrace * "\n "}
end

private
Expand Down

0 comments on commit f92a858

Please sign in to comment.