From 541ff1f58afec1fcdc10fa4d0a5b4ff1e63eabb8 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Fri, 3 May 2013 09:50:20 -0700 Subject: [PATCH] Ignore Shutdown exception in retry middleware, fixes #897 --- Changes.md | 1 + lib/sidekiq/middleware/server/retry_jobs.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/Changes.md b/Changes.md index 43df7c7a..3c31f18c 100644 --- a/Changes.md +++ b/Changes.md @@ -1,6 +1,7 @@ 2.11.3 ----------- +- Fix unclean shutdown leading to duplicate jobs [#897] - Add Korean locale [#890] 2.11.2 diff --git a/lib/sidekiq/middleware/server/retry_jobs.rb b/lib/sidekiq/middleware/server/retry_jobs.rb index d9b7f6fc..8b4bb5e7 100644 --- a/lib/sidekiq/middleware/server/retry_jobs.rb +++ b/lib/sidekiq/middleware/server/retry_jobs.rb @@ -48,6 +48,9 @@ module Sidekiq def call(worker, msg, queue) yield + rescue Sidekiq::Shutdown + # ignore, will be pushed back onto queue + raise rescue Exception => e raise e unless msg['retry'] max_retry_attempts = retry_attempts_from(msg['retry'], DEFAULT_MAX_RETRY_ATTEMPTS)