Merge pull request #15 from doits/monotonic_time

use monotonic time for retry timeout check
This commit is contained in:
Nick Elser
2021-01-21 10:27:46 -08:00
committed by GitHub

View File

@@ -132,10 +132,10 @@ module Suo
end end
def retry_with_timeout def retry_with_timeout
start = Time.now.to_f start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
retry_count.times do retry_count.times do
elapsed = Time.now.to_f - start elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
break if elapsed >= options[:acquisition_timeout] break if elapsed >= options[:acquisition_timeout]
synchronize do synchronize do