From 4f5a9890b70a426909a40ade94a013f5253b0421 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 3 Aug 2016 14:30:39 -0700 Subject: Guard against jobs that were persisted before we started counting executions by zeroing out nil counters --- activejob/lib/active_job/execution.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activejob/lib') 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 -- cgit v1.2.3