1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-04-27 18:53:23 +02:00
parent 00c33d9c23
commit a1b4816759
193 changed files with 3026 additions and 3387 deletions

View file

@ -71,12 +71,12 @@ module SocketSpecs
end
end
def self.loop_with_timeout(timeout = 5)
def self.loop_with_timeout(timeout = TIME_TOLERANCE)
require 'timeout'
time = Time.now
time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
loop do
if Time.now - time >= timeout
if Process.clock_gettime(Process::CLOCK_MONOTONIC) - time >= timeout
raise TimeoutError, "Did not succeed within #{timeout} seconds"
end
@ -85,7 +85,7 @@ module SocketSpecs
end
end
def self.wait_until_success(timeout = 5)
def self.wait_until_success(timeout = TIME_TOLERANCE)
loop_with_timeout(timeout) do
begin
return yield