From e49fb7921e94d533ed39c197cf0287120d389b28 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Wed, 25 Jul 2018 17:30:38 +0900 Subject: Increment execution count before deserialize arguments Currently, the execution count increments after deserializes arguments. Therefore, if an error occurs with deserialize, it retries indefinitely. In order to prevent this, the count is moved before deserialize. Fixes #33344. --- activejob/lib/active_job/execution.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activejob/lib') diff --git a/activejob/lib/active_job/execution.rb b/activejob/lib/active_job/execution.rb index d75be376ec..f5a343311f 100644 --- a/activejob/lib/active_job/execution.rb +++ b/activejob/lib/active_job/execution.rb @@ -31,11 +31,11 @@ module ActiveJob # # MyJob.new(*args).perform_now def perform_now + # Guard against jobs that were persisted before we started counting executions by zeroing out nil counters + self.executions = (executions || 0) + 1 + deserialize_arguments_if_needed run_callbacks :perform do - # Guard against jobs that were persisted before we started counting executions by zeroing out nil counters - self.executions = (executions || 0) + 1 - perform(*arguments) end rescue => exception -- cgit v1.2.3