-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
> 2.0.0 .lock! no longer works #137
Comments
From this comment I see that perhaps I should change lock_manager = Redlock::Client.new(["redis://redis:6379/1"])
<snip>
(0..9).map do |i|
Thread.new do
lock_manager.lock!('lockname', lock_time, retry_count: retry_count, retry_delay: retry_delay) do
<snip> to <snip>
(0..9).map do |i|
Thread.new do
Redlock::Client.new(["redis://redis:6379/1"]).lock!('lockname', lock_time, retry_count: retry_count, retry_delay: retry_delay) do
<snip> Is that the correct fix? I'm sorry but I don't quite understand why my usage is wrong but would appreciate any advice on this. |
@hirowatari This appears to be fixed in the latest version of the gem. Try the same thing on 2.0.4. |
I was chasing this same problem and it was definitely the fact that a |
I upgraded to 2.0.6 today and all is well. Thank you. |
Minimal reproduction
Output in version 1.3.2
This is consistent and I have a test that looks similar to this (with some real work instead of sleeping)
that has been working in production and relying on this behaviour for a long time.
Output in version 2.0.2
Have I misunderstood how this is supposed to work, or is this a bug? I had expected only one thread to be able to get the lock at the same time.
The text was updated successfully, but these errors were encountered: