Skip to content

Commit

Permalink
change Sidekiq::Processor.retry_and_suppress_exceptions to use
Browse files Browse the repository at this point in the history
exponential sleep and change default retry to 5
  • Loading branch information
victor-huang committed May 18, 2015
1 parent a3c5321 commit c47bcf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sidekiq/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ def cloned(ary)

# 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
rescue => e
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"})
Expand Down

0 comments on commit c47bcf8

Please sign in to comment.