Skip to content

Commit

Permalink
Merge pull request #15 from doits/monotonic_time
Browse files Browse the repository at this point in the history
use monotonic time for retry timeout check
  • Loading branch information
nickelser authored Jan 21, 2021
2 parents 485f2bf + 6e74322 commit 6b6eb4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/suo/client/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def synchronize
end

def retry_with_timeout
start = Time.now.to_f
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)

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

synchronize do
Expand Down

0 comments on commit 6b6eb4e

Please sign in to comment.