1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

change Sidekiq::Processor.retry_and_suppress_exceptions to use

exponential sleep and change default retry to 5
This commit is contained in:
Victor Huang 2015-05-18 15:24:19 -07:00
parent a3c53211be
commit c47bcf8a61

View file

@ -132,7 +132,7 @@ module Sidekiq
# If an exception occurs in the block passed to this method, that block will be retried up to max_retries times.
# All exceptions will be swallowed and logged.
def retry_and_suppress_exceptions(max_retries = 2)
def retry_and_suppress_exceptions(max_retries = 5)
retry_count = 0
begin
yield
@ -140,7 +140,7 @@ module Sidekiq
retry_count += 1
if retry_count <= max_retries
Sidekiq.logger.debug {"Suppressing and retrying error: #{e.inspect}"}
sleep(1)
sleep(retry_count * retry_count)
retry
else
handle_exception(e, { :message => "Exhausted #{max_retries} retries"})