Skip to content

Commit

Permalink
Merge pull request #3640 from fluent/issue-3609
Browse files Browse the repository at this point in the history
Fix wrong calculation of max retry timeout for exponential backoff
  • Loading branch information
ashie committed Feb 25, 2022
2 parents 8ced42c + 00a5cc1 commit c759ebe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fluent/plugin_helper/retry_state.rb
Expand Up @@ -159,7 +159,7 @@ def naive_next_time(retry_next_times)
def calc_max_retry_timeout(max_steps)
result = 0
max_steps.times { |i|
result += calc_interval(i)
result += calc_interval(i + 1)
}
result
end
Expand Down
2 changes: 1 addition & 1 deletion test/plugin_helper/test_retry_state.rb
Expand Up @@ -413,7 +413,7 @@ class Dummy < Fluent::Plugin::TestBase
override_current_time(s, dummy_current_time)

timeout = 0
5.times { |i| timeout += 1.0 * (2 ** (i - 1)) }
5.times { |i| timeout += 1.0 * (2 ** i) }

assert_equal dummy_current_time, s.current_time
assert_equal (dummy_current_time + 100), s.timeout_at
Expand Down

0 comments on commit c759ebe

Please sign in to comment.