From c47bcf8a61a5a6793076e8fc213daa23960c8219 Mon Sep 17 00:00:00 2001 From: Victor Huang Date: Mon, 18 May 2015 15:24:19 -0700 Subject: [PATCH] change Sidekiq::Processor.retry_and_suppress_exceptions to use exponential sleep and change default retry to 5 --- lib/sidekiq/processor.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sidekiq/processor.rb b/lib/sidekiq/processor.rb index 1274369e..83dab117 100644 --- a/lib/sidekiq/processor.rb +++ b/lib/sidekiq/processor.rb @@ -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"})