aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/core.rb
diff options
context:
space:
mode:
authorRosa Gutierrez <rosa.ge@gmail.com>2019-01-07 17:18:17 +0100
committerRosa Gutierrez <rosa.ge@gmail.com>2019-01-08 12:08:06 +0100
commitacbbd4ab8d3c51ca464a97245c4d7709259472f9 (patch)
tree455cb33c2a22bcee4489280de51cdc24b76b67f6 /activejob/lib/active_job/core.rb
parent154057b4f7d8bcf37637ec7185ede3c4d0cd6583 (diff)
downloadrails-acbbd4ab8d3c51ca464a97245c4d7709259472f9.tar.gz
rails-acbbd4ab8d3c51ca464a97245c4d7709259472f9.tar.bz2
rails-acbbd4ab8d3c51ca464a97245c4d7709259472f9.zip
Ensure 0 is always the default for the individual exception counters in ActiveJob
Some adapters like Resque that use Redis, convert the Ruby hash with a default value, Hash.new(0), into a regular hash without a default value after serializing, storing and deserializing. This raises an error when we try to access a missing exception key. A simple solution is not to rely on the hash's default value, and provide a default as alternative when accessing it instead.
Diffstat (limited to 'activejob/lib/active_job/core.rb')
-rw-r--r--activejob/lib/active_job/core.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb
index 4ab62f89b0..487cdd6d38 100644
--- a/activejob/lib/active_job/core.rb
+++ b/activejob/lib/active_job/core.rb
@@ -81,7 +81,7 @@ module ActiveJob
@queue_name = self.class.queue_name
@priority = self.class.priority
@executions = 0
- @exception_executions = Hash.new(0)
+ @exception_executions = {}
end
# Returns a hash with the job data that can safely be passed to the