diff options
author | Patrik Bóna <patrik.bona@mrhead.sk> | 2019-04-12 17:24:05 +0200 |
---|---|---|
committer | Patrik Bóna <patrik.bona@mrhead.sk> | 2019-04-12 17:47:08 +0200 |
commit | 3a7fa10603b6842251a6e8b22c302253ae7999ab (patch) | |
tree | fa7654e2edcafae7194c0385740a51bbcb30c6a7 /activejob/lib | |
parent | ef0c5fe0d98ad1b1b27fe3d6d19ae62aed3e8aa1 (diff) | |
download | rails-3a7fa10603b6842251a6e8b22c302253ae7999ab.tar.gz rails-3a7fa10603b6842251a6e8b22c302253ae7999ab.tar.bz2 rails-3a7fa10603b6842251a6e8b22c302253ae7999ab.zip |
Use individual execution counters when calculating retry delay
Individual execution counters were introduced in #34352. However
`#determine_delay` which is used to calculate retry delay still uses the
global counter. This commit fixes it.
Diffstat (limited to 'activejob/lib')
-rw-r--r-- | activejob/lib/active_job/exceptions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activejob/lib/active_job/exceptions.rb b/activejob/lib/active_job/exceptions.rb index 9e00942a1c..35c1476368 100644 --- a/activejob/lib/active_job/exceptions.rb +++ b/activejob/lib/active_job/exceptions.rb @@ -54,7 +54,7 @@ module ActiveJob self.exception_executions[exceptions.to_s] = (exception_executions[exceptions.to_s] || 0) + 1 if exception_executions[exceptions.to_s] < attempts - retry_job wait: determine_delay(wait), queue: queue, priority: priority, error: error + retry_job wait: determine_delay(seconds_or_duration_or_algorithm: wait, executions: exception_executions[exceptions.to_s]), queue: queue, priority: priority, error: error else if block_given? instrument :retry_stopped, error: error do @@ -123,7 +123,7 @@ module ActiveJob end private - def determine_delay(seconds_or_duration_or_algorithm) + def determine_delay(seconds_or_duration_or_algorithm:, executions:) case seconds_or_duration_or_algorithm when :exponentially_longer (executions**4) + 2 |