diff --git a/lib/fluent/plugin_helper/retry_state.rb b/lib/fluent/plugin_helper/retry_state.rb index 687e8052f3..7851fd61ea 100644 --- a/lib/fluent/plugin_helper/retry_state.rb +++ b/lib/fluent/plugin_helper/retry_state.rb @@ -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 diff --git a/test/plugin_helper/test_retry_state.rb b/test/plugin_helper/test_retry_state.rb index 616cc8671d..4edd41bdf9 100644 --- a/test/plugin_helper/test_retry_state.rb +++ b/test/plugin_helper/test_retry_state.rb @@ -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