-
Notifications
You must be signed in to change notification settings - Fork 68
Open
Description
When you have many semaphore instances with the same key, only the one that called lock
knows that the semaphore is locked, but all of them should find the correct state with locked?
. Example of the faulty behavior:
[1] pry(main)> redis_sema = Redis::Semaphore.new(:my_sema)
=> #<Redis::Semaphore:0x007fc6d8c8aae0
@expiration=nil,
@name=:my_sema,
@redis=#<Redis client v3.3.0 for redis://127.0.0.1:6379/0>,
@resource_count=1,
@stale_client_timeout=nil,
@tokens=[],
@use_local_time=nil>
[2] pry(main)> redis_sema.lock
=> "0"
[3] pry(main)> redis_sema2 = Redis::Semaphore.new(:my_sema)
=> #<Redis::Semaphore:0x007fc6d8b480d8
@expiration=nil,
@name=:my_sema2,
@redis=#<Redis client v3.3.0 for redis://127.0.0.1:6379/0>,
@resource_count=1,
@stale_client_timeout=nil,
@tokens=[],
@use_local_time=nil>
[4] pry(main)> redis_sema2.locked?
=> false
[5] pry(main)> redis_sema.locked?
=> true
aklaiber, disyukvitaliy and NickDiMucci
Metadata
Metadata
Assignees
Labels
No labels