Sha256: 070d2d8162bdcbeabb8025efecfd95d87d2cba47e5d29a634e882a5f9a5463a5
Contents?: true
Size: 554 Bytes
Versions: 4
Compression:
Stored size: 554 Bytes
Contents
# encoding: utf-8 require "belzebuth/wait_condition/base" require "uri" require "net/http" module Belzebuth module WaitCondition class Api < Base MAX_SLEEP_TIME = 10 def initialize(uri, max_sleep_time = MAX_SLEEP_TIME) @uri = URI(uri) @sleep_time = 1 @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 false end def sleep_time_between_condition @sleep_time end end end end
Version data entries
4 entries across 4 versions & 1 rubygems