lib/belzebuth/wait_condition/api.rb in belzebuth-0.2.2 vs lib/belzebuth/wait_condition/api.rb in belzebuth-0.2.3
- old
+ new
@@ -7,18 +7,19 @@
class Api < Base
MAX_SLEEP_TIME = 10
def initialize(uri, max_sleep_time = MAX_SLEEP_TIME)
@uri = URI(uri)
- @sleep_time = 1
+ @sleep_time = 0
@max_sleep_time = max_sleep_time
end
def call(process)
Net::HTTP.get(@uri)
true
rescue => e
- @sleep_time = [@sleep_time +1, @max_sleep_time].min
+ @sleep_time += 1
+ @sleep_time = [@sleep_time, @max_sleep_time].min
false
end
def sleep_time_between_condition
@sleep_time