mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add an interval parameter to wait_for
This commit is contained in:
parent
4315a65e51
commit
5f37f6be26
2 changed files with 4 additions and 4 deletions
|
@ -68,11 +68,11 @@ module Fog
|
|||
!!@mocking
|
||||
end
|
||||
|
||||
def self.wait_for(timeout = 600, &block)
|
||||
def self.wait_for(timeout=600, interval=1, &block)
|
||||
duration = 0
|
||||
start = Time.now
|
||||
until yield || duration > timeout
|
||||
sleep(1)
|
||||
sleep(interval)
|
||||
duration = Time.now - start
|
||||
end
|
||||
if duration > timeout
|
||||
|
|
|
@ -39,9 +39,9 @@ module Fog
|
|||
attributes.to_json
|
||||
end
|
||||
|
||||
def wait_for(timeout = 600, &block)
|
||||
def wait_for(timeout=600, interval=1, &block)
|
||||
reload
|
||||
Fog.wait_for(timeout) do
|
||||
Fog.wait_for(timeout, interval) do
|
||||
reload or raise StandardError.new("Reload failed, #{self.class} #{self.identity} went away.")
|
||||
instance_eval(&block)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue