diff --git a/lib/fluent/plugin_helper/retry_state.rb b/lib/fluent/plugin_helper/retry_state.rb index 7851fd61ea..b20b4d0e8f 100644 --- a/lib/fluent/plugin_helper/retry_state.rb +++ b/lib/fluent/plugin_helper/retry_state.rb @@ -158,7 +158,7 @@ def naive_next_time(retry_next_times) def calc_max_retry_timeout(max_steps) result = 0 - max_steps.times { |i| + (0..max_steps).each { |i| result += calc_interval(i + 1) } result diff --git a/test/plugin_helper/test_retry_state.rb b/test/plugin_helper/test_retry_state.rb index 4edd41bdf9..08fb39eb84 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) } + (0..5).each { |i| timeout += 1.0 * (2 ** i) } assert_equal dummy_current_time, s.current_time assert_equal (dummy_current_time + 100), s.timeout_at