Skip to content

Commit 6a22519

Browse files
committed
Added ensure block to make sure @failure_hooks_already_ran is set when failure hooks throw an exception
1 parent 822b1e9 commit 6a22519

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/resque/job.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ def failure_hooks
216216
end
217217

218218
def run_failure_hooks(exception)
219-
unless @failure_hooks_already_ran
220-
job_args = args || []
221-
failure_hooks.each { |hook| payload_class.send(hook, exception, *job_args) }
219+
begin
220+
failure_hooks.each { |hook| payload_class.send(hook, exception, *Array.wrap(args)) } unless @failure_hooks_already_ran
221+
ensure
222222
@failure_hooks_already_ran = true
223223
end
224224
end

0 commit comments

Comments
 (0)