Skip to content
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

Lock is not reliable #64

Open
nikolai-b opened this issue Feb 10, 2020 · 0 comments
Open

Lock is not reliable #64

nikolai-b opened this issue Feb 10, 2020 · 0 comments

Comments

@nikolai-b
Copy link

If the process running "redis-semaphore" dies after blpop (or lpop) and before hset then the the key is lost for good https://github.com/dv/redis-semaphore/blob/master/lib/redis/semaphore.rb#L65-L73

_key, current_token = @redis.blpop(available_key, timeout || 0)
else
current_token = @redis.lpop(available_key)
end
return false if current_token.nil?
@tokens.push(current_token)
@redis.hset(grabbed_key, current_token, current_time.to_f)

I don't think you can use a multi command here https://redis.io/commands/blpop#codeblpopcode-inside-a-codemulticode--codeexeccode-transaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant