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

Ensure that the semaphore keeps working when app after lpop of available key #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bliof
Copy link

@bliof bliof commented Mar 8, 2020

Problem

You can kill the app in def lock just after the lpop of the
available_key

When that happens the semaphore is gone forever. To fix it you have to
manually delete the exists key.

Expirations also don't help as for some reason the exists key get -1 as a ttl

Solution

The fix is to recreate the keys in redis if there isn't an AVAILABLE or GRABBED key

Related

https://stackoverflow.com/questions/60269868/redis-semaphore-locks-cant-be-released/

ps. I have never used the gem

…ble key

= Problem

You can kill the app in `def lock` just after the lpop of the
available_key

When that happens the semaphore is gone forever. To fix it you have to
manually delete the exists key.

Expirations also don't help as for some reason the exists key get -1 as a ttl

= Solution

The fix is to recreate the keys in redis if there isn't an AVAILABLE or GRABBED key

= Related

https://stackoverflow.com/questions/60269868/redis-semaphore-locks-cant-be-released/
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

Successfully merging this pull request may close these issues.

None yet

1 participant