logstash-output-jdbc/scripts/minutes_to_retries.rb
2016-05-17 11:29:49 +01:00

21 lines
410 B
Ruby
Executable File

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