From c045946d65b0b650cf62320768aeff65f34482cd Mon Sep 17 00:00:00 2001 From: Adam Mikulasev Date: Wed, 6 Nov 2019 22:42:28 +1100 Subject: [PATCH] send job to morgue before calling death handlers (#4363) --- lib/sidekiq/job_retry.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sidekiq/job_retry.rb b/lib/sidekiq/job_retry.rb index 02c3e384..ee34bea1 100644 --- a/lib/sidekiq/job_retry.rb +++ b/lib/sidekiq/job_retry.rb @@ -189,13 +189,13 @@ module Sidekiq handle_exception(e, {context: "Error calling retries_exhausted", job: msg}) end + send_to_morgue(msg) unless msg["dead"] == false + Sidekiq.death_handlers.each do |handler| handler.call(msg, exception) rescue => e handle_exception(e, {context: "Error calling death handler", job: msg}) end - - send_to_morgue(msg) unless msg["dead"] == false end def send_to_morgue(msg)