Skip to content

Commit 6b6eb4e

Browse files
authored
Merge pull request #15 from doits/monotonic_time
use monotonic time for retry timeout check
2 parents 485f2bf + 6e74322 commit 6b6eb4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/suo/client/base.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ def synchronize
132132
end
133133

134134
def retry_with_timeout
135-
start = Time.now.to_f
135+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
136136

137137
retry_count.times do
138-
elapsed = Time.now.to_f - start
138+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
139139
break if elapsed >= options[:acquisition_timeout]
140140

141141
synchronize do

0 commit comments

Comments
 (0)