Sha256: c894463f4545c6c15198bff7af3216cb07143c47a1c4fbc74e84481d515dbb0d
Contents?: true
Size: 489 Bytes
Versions: 32
Compression:
Stored size: 489 Bytes
Contents
module Elasticity class Looper def initialize(on_retry_check, on_wait = nil, poll_interval = 60) @on_retry_check = on_retry_check @on_wait = on_wait @poll_interval = poll_interval end def go start_time = Time.now loop do should_continue, *results = @on_retry_check.call return unless should_continue @on_wait.call(Time.now - start_time, *results) if @on_wait sleep(@poll_interval) end end end end
Version data entries
32 entries across 32 versions & 1 rubygems