Skip to content

Commit d5bfb01

Browse files
committed
Fix wrong max retry timeout for exponential backoff again
The patch in #3640 was still wrong, the expected one is c + c * b^1 + (...) + c*b^k but the patch was c + c * b^1 + (...) + c*b^(k-1) Signed-off-by: Takuro Ashie <[email protected]>
1 parent 6927305 commit d5bfb01

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/fluent/plugin_helper/retry_state.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def naive_next_time(retry_next_times)
158158

159159
def calc_max_retry_timeout(max_steps)
160160
result = 0
161-
max_steps.times { |i|
161+
(0..max_steps).each { |i|
162162
result += calc_interval(i + 1)
163163
}
164164
result

test/plugin_helper/test_retry_state.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ class Dummy < Fluent::Plugin::TestBase
413413
override_current_time(s, dummy_current_time)
414414

415415
timeout = 0
416-
5.times { |i| timeout += 1.0 * (2 ** i) }
416+
(0..5).each { |i| timeout += 1.0 * (2 ** i) }
417417

418418
assert_equal dummy_current_time, s.current_time
419419
assert_equal (dummy_current_time + 100), s.timeout_at

0 commit comments

Comments
 (0)