aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2016-08-03 14:30:39 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2016-08-03 14:30:39 -0700
commit4f5a9890b70a426909a40ade94a013f5253b0421 (patch)
tree58b226e51aab8b595552c7527d74838f79fae661 /activejob
parentca0b6d0d416776655ed7516ac18f126fbde5315a (diff)
downloadrails-4f5a9890b70a426909a40ade94a013f5253b0421.tar.gz
rails-4f5a9890b70a426909a40ade94a013f5253b0421.tar.bz2
rails-4f5a9890b70a426909a40ade94a013f5253b0421.zip
Guard against jobs that were persisted before we started counting executions by zeroing out nil counters
Diffstat (limited to 'activejob')
-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