logstash-output-jdbc/scripts/minutes_to_retries.rb

20 lines
389 B
Ruby
Raw Permalink Normal View History

2016-05-17 10:29:49 +00:00
#!/usr/bin/env ruby -w
seconds_to_reach = 10 * 60
retry_max_interval = 128
current_interval = 2
total_interval = 0
exceptions_count = 1
loop do
break if total_interval > seconds_to_reach
2016-05-17 10:29:49 +00:00
exceptions_count += 1
current_interval = current_interval * 2 > retry_max_interval ? retry_max_interval : current_interval * 2
2016-05-17 10:29:49 +00:00
total_interval += current_interval
end
puts exceptions_count