diff options
Diffstat (limited to 'activejob/lib/active_job/execution.rb')
-rw-r--r-- | activejob/lib/active_job/execution.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/activejob/lib/active_job/execution.rb b/activejob/lib/active_job/execution.rb index 7c4151fc90..d75be376ec 100644 --- a/activejob/lib/active_job/execution.rb +++ b/activejob/lib/active_job/execution.rb @@ -1,5 +1,7 @@ -require 'active_support/rescuable' -require 'active_job/arguments' +# frozen_string_literal: true + +require "active_support/rescuable" +require "active_job/arguments" module ActiveJob module Execution @@ -31,10 +33,13 @@ 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 - rescue_with_handler(exception) || raise(exception) + rescue_with_handler(exception) || raise end def perform(*) |