-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
If a lock was not obtained in the lock function, is it desired behavior to sleep (in line 80), even after the last retry?
I think that the last retry's sleep will be a waste of time, if the lock was not obtained.
Lines 55 to 57 in 97be08b
| def lock(resource,ttl) | |
| val = get_unique_lock_id | |
| @retry_count.times { |
Lines 79 to 81 in 97be08b
| # Wait a random delay before to retry | |
| sleep(rand(@retry_delay).to_f/1000) | |
| } |
If my argument holds, how about:
for i in 0..(retry_count-1)
# The major part of the lock function goes here.
# Don't sleep if it's the last retry.
if (i != retry_count-1)
# Wait a random part of retry_delay, before retrying.
sleep(rand(@retry_delay).to_f/1000)
end
end
Metadata
Metadata
Assignees
Labels
No labels