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

Delete the entry for the waiter when the timeout is reached #694

Merged
merged 1 commit into from
Apr 8, 2020

Conversation

ankon
Copy link
Contributor

@ankon ankon commented Apr 7, 2020

When the lock times out the promise rejects, and the calling code will do "something sensible". Something sensible
could be to retry later -- but that actually requires the lock to be able to be acquired again. Right now this is
not possible, because the failed tryToAcquire is still inside the waiting queue -- and will never release the lock.

@ankon
Copy link
Contributor Author

ankon commented Apr 7, 2020

This should fix one aspect of the problem mentioned in #666 (comment): We should be able to continue, even after a client has hit the timeout.

I still need to find the reason for timeout, but I think this is independent and might be more caused by what my application code is doing with KafkaJS.

src/utils/lock.js Outdated Show resolved Hide resolved
When the lock times out the promise rejects, and the calling code will do "something sensible". Something sensible
could be to retry later -- but that actually requires the lock to be able to be acquired again. Right now this is
not possible, because the failed `tryToAcquire` is still inside the waiting queue -- and will never release the lock.
@ankon ankon force-pushed the pr/lock-delete-waiter-on-timeout branch from 42c15be to 86ef01b Compare April 8, 2020 16:30
@ankon
Copy link
Contributor Author

ankon commented Apr 8, 2020

I think the first option is fine. It is a bit unintuitive since there's nothing to indicate that the error will contain a reference to the waiting list, but it's fine.

Changed. I added a comment as well, so that readers of the code won't be too confused :)

@Nevon Nevon merged commit 2faef07 into tulios:master Apr 8, 2020
@ankon ankon deleted the pr/lock-delete-waiter-on-timeout branch April 8, 2020 17:31
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.

2 participants