mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[general] Allow default wait_for interval to be overiden globally.
This commit is contained in:
parent
a8f7033530
commit
c9daa2ba1c
3 changed files with 13 additions and 1 deletions
|
@ -20,6 +20,7 @@ require 'fog/core/current_machine'
|
||||||
require 'fog/core/deprecation'
|
require 'fog/core/deprecation'
|
||||||
require 'fog/core/errors'
|
require 'fog/core/errors'
|
||||||
require 'fog/core/hmac'
|
require 'fog/core/hmac'
|
||||||
|
require 'fog/core/interval'
|
||||||
require 'fog/core/logger'
|
require 'fog/core/logger'
|
||||||
require 'fog/core/model'
|
require 'fog/core/model'
|
||||||
require 'fog/core/mock'
|
require 'fog/core/mock'
|
||||||
|
|
11
lib/fog/core/interval.rb
Normal file
11
lib/fog/core/interval.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
module Fog
|
||||||
|
@interval = 1
|
||||||
|
def self.interval
|
||||||
|
@interval
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.interval=(interval)
|
||||||
|
raise ArgumentError, "interval must be non-negative" unless interval >= 0
|
||||||
|
@interval = interval
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
module Fog
|
module Fog
|
||||||
def self.wait_for(timeout=Fog.timeout, interval=1, &block)
|
def self.wait_for(timeout=Fog.timeout, interval=Fog.interval, &block)
|
||||||
duration = 0
|
duration = 0
|
||||||
start = Time.now
|
start = Time.now
|
||||||
until yield || duration > timeout
|
until yield || duration > timeout
|
||||||
|
|
Loading…
Reference in a new issue