Skip to content

Commit

Permalink
Merge pull request #2913 from ganmacs/follow-up-2901-2
Browse files Browse the repository at this point in the history
`now` is less than 2016-04-13 18:34:31
  • Loading branch information
ganmacs committed Mar 27, 2020
2 parents c90c024 + efb8edb commit a593786
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/plugin/test_output_as_buffered_secondary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,15 @@ def dummy_event_stream
assert{ !chunks[1].empty? }

30.times do |i| # large enough
now = first_failure + 60 * 0.8 + 2 + [i, 9].min # must be less than retry_timeout
# In https://github.com/fluent/fluentd/blob/c90c024576b3d35f356a55fd33d1232947114a9a/lib/fluent/plugin_helper/retry_state.rb
# @timeout_at is 2016-04-13 18:34:31, @next_time must be less than 2016-04-13 18:34:30
#
# first_failure + 60 * 0.8 + 2 # => 2016-04-13 18:34:21
# @next_time is not added by 1, but by randomize(@retry_wait) https://github.com/fluent/fluentd/blob/c90c024576b3d35f356a55fd33d1232947114a9a/lib/fluent/plugin_helper/retry_state.rb#L196
# current_time(=Time.now) + randomize(@retry_wait) < @timeout_at
# (2016-04-13 18:34:21 + 6) + 3 < 2016-04-13 18:34:31
# So, current_time must be at most 6
now = first_failure + 60 * 0.8 + 2 + [i, 6].min
Timecop.freeze( now )
@i.flush_thread_wakeup

Expand Down

0 comments on commit a593786

Please sign in to comment.