Skip to content

Commit ff64426

Browse files
committed
Simplify failure hook by calling recover_from_failure directly
Skip unwrapping the job handler - we're already in the job instance context and respond_to? is already checked by the super method in the Delayed::Job wrapper.
1 parent 7b2fab2 commit ff64426

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

app/jobs/pollable_job_wrapper.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@ def error(job, exception)
7070
end
7171

7272
def failure(job)
73-
if @handler.respond_to?(:recover_from_failure)
74-
begin
75-
@handler.recover_from_failure
76-
rescue StandardError => e
77-
logger.error("failure recovery failed: #{e.class}: #{e.message}")
78-
end
73+
begin
74+
recover_from_failure
75+
rescue StandardError => e
76+
logger.error("failure recovery failed: #{e.class}: #{e.message}")
7977
end
8078

8179
change_state(job, PollableJobModel::FAILED_STATE)

0 commit comments

Comments
 (0)