Skip to content

Conversation

albe
Copy link

@albe albe commented May 28, 2021

Closes #105

TODO:

  • Add tests
  • Add docs

@albe
Copy link
Author

albe commented May 28, 2021

One thing I'm not sure about is the race condition for the reclaiming now - if two processes start with a stale lock, then one starts to delete it, the other in the meantime acquires the lock and the second one then fails to acquire the lock, the callback will not be invoked and the information that a stale lock existed is lost.
If however the callback is invoked immediately after removing the stale lock, then multiple processes could invoke the onReclaimedStale (or whatever it will be called finally) callback, which is potentially unintended.
So can we make the "reclaiming" atomic? i.e. instead of "delete + acquire" just overwrite the existing lock?

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.

Feature Request: Provide an API to react on a stale lock that is reclaimed

1 participant