mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
0035231954
Signed-off-by: Nelvin Driz <nelvindriz@live.com>
15 lines
314 B
Ruby
15 lines
314 B
Ruby
module Fog
|
|
def self.wait_for(timeout=Fog.timeout, interval=1, &block)
|
|
duration = 0
|
|
start = Time.now
|
|
until yield || duration > timeout
|
|
sleep(interval.to_f)
|
|
duration = Time.now - start
|
|
end
|
|
if duration > timeout
|
|
false
|
|
else
|
|
{ :duration => duration }
|
|
end
|
|
end
|
|
end
|