From 4e58db78a459b695facd41b643976cfadc3277dc Mon Sep 17 00:00:00 2001 From: Caius Durling Date: Wed, 20 Dec 2023 21:57:07 +0000 Subject: [PATCH] Lean on ActiveJob::Base to execute the job This follows the other queue adapters in ActiveJob upstream, and Delayed::Job's queue adapter as well. Ensures the job deserialize is called within the executor block/execute callbacks along with perform. If the deserialize method is causing side effects like using ActiveSupport::CurrentAttributes they won't get cleared between deserialize and perform being invoked. --- lib/delayed/job_wrapper.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/delayed/job_wrapper.rb b/lib/delayed/job_wrapper.rb index 4cb2b5e..9beec95 100644 --- a/lib/delayed/job_wrapper.rb +++ b/lib/delayed/job_wrapper.rb @@ -21,9 +21,7 @@ def display_name end def perform - ActiveJob::Callbacks.run_callbacks(:execute) do - job.perform_now - end + ActiveJob::Base.execute(job_data) end def encode_with(coder)