aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activejob/lib/active_job/execution.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activejob/lib/active_job/execution.rb b/activejob/lib/active_job/execution.rb
index 0c047cd4e1..e374a9489d 100644
--- a/activejob/lib/active_job/execution.rb
+++ b/activejob/lib/active_job/execution.rb
@@ -31,7 +31,9 @@ module ActiveJob
def perform_now
deserialize_arguments_if_needed
run_callbacks :perform do
- self.executions = executions + 1
+ # 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