Sha256: e39857a3b3195645c109328d91f31ad12e0b2804c574f251a48698d938ee1a09
Contents?: true
Size: 499 Bytes
Versions: 3
Compression:
Stored size: 499 Bytes
Contents
module Fog def self.wait_for(timeout=Fog.timeout, interval=Fog.interval, &block) duration = 0 start = Time.now retries = 0 until yield || duration > timeout sleep(interval.respond_to?(:call) ? interval.call(retries += 1).to_f : interval.to_f) duration = Time.now - start end if duration > timeout raise Errors::TimeoutError.new("The specified wait_for timeout (#{timeout} seconds) was exceeded") else { :duration => duration } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fog-core-1.24.0 | lib/fog/core/wait_for.rb |
fog-core-1.23.0 | lib/fog/core/wait_for.rb |
fog-core-1.22.0 | lib/fog/core/wait_for.rb |