diff options
Diffstat (limited to 'activejob/lib/active_job/execution.rb')
-rw-r--r-- | activejob/lib/active_job/execution.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activejob/lib/active_job/execution.rb b/activejob/lib/active_job/execution.rb index 4e4acfc2c2..94d30c8eaf 100644 --- a/activejob/lib/active_job/execution.rb +++ b/activejob/lib/active_job/execution.rb @@ -1,5 +1,5 @@ -require 'active_support/rescuable' -require 'active_job/arguments' +require "active_support/rescuable" +require "active_job/arguments" module ActiveJob module Execution @@ -31,6 +31,9 @@ module ActiveJob def perform_now 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 |