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:
parent
a3c53211be
commit
c47bcf8a61
1 changed files with 2 additions and 2 deletions
|
@ -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.
|
# 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.
|
# 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
|
retry_count = 0
|
||||||
begin
|
begin
|
||||||
yield
|
yield
|
||||||
|
@ -140,7 +140,7 @@ module Sidekiq
|
||||||
retry_count += 1
|
retry_count += 1
|
||||||
if retry_count <= max_retries
|
if retry_count <= max_retries
|
||||||
Sidekiq.logger.debug {"Suppressing and retrying error: #{e.inspect}"}
|
Sidekiq.logger.debug {"Suppressing and retrying error: #{e.inspect}"}
|
||||||
sleep(1)
|
sleep(retry_count * retry_count)
|
||||||
retry
|
retry
|
||||||
else
|
else
|
||||||
handle_exception(e, { :message => "Exhausted #{max_retries} retries"})
|
handle_exception(e, { :message => "Exhausted #{max_retries} retries"})
|
||||||
|
|
Loading…
Reference in a new issue