mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2477 from Technicolor-Portico/master
[general] Allow default wait_for interval to be overriden globally.
This commit is contained in:
commit
88be6ebd11
3 changed files with 12 additions and 2 deletions
|
@ -28,8 +28,8 @@ require 'fog/core/service'
|
|||
require 'fog/core/ssh'
|
||||
require 'fog/core/scp'
|
||||
require 'fog/core/time'
|
||||
require 'fog/core/timeout'
|
||||
require 'fog/core/wait_for'
|
||||
require 'fog/core/wait_for_defaults'
|
||||
require 'fog/core/class_from_string'
|
||||
require 'fog/core/uuid'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
start = Time.now
|
||||
until yield || duration > timeout
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
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
|
||||
|
||||
@timeout = 600
|
||||
def self.timeout
|
||||
@timeout
|
Loading…
Reference in a new issue