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

fix: handle NATS connection closing itself #24

Merged
merged 2 commits into from
Mar 3, 2022
Merged

Conversation

smlx
Copy link
Member

@smlx smlx commented Mar 3, 2022

If the NATS server restarts then the connection will close itself due to
authorization failures. Previously the connection closing itself instead
of being instigated by service-api could lead to a deadlock by blocking
on <-ctx.Done().

This change cancels the context in the NATS connection closed handler to
avoid the deadlock.

smlx added 2 commits March 3, 2022 21:56
If the NATS server restarts then the connection will close itself due to
authorization failures. Previously the connection closing itself instead
of being instigated by service-api could lead to a deadlock by blocking
on <-ctx.Done().

This change cancels the context in the NATS connection closed handler to
avoid the deadlock.
This should produce a warning only since it can happen if the NATS
connection is closed by an error handler before we try to drain it.
@smlx smlx merged commit eaea37e into main Mar 3, 2022
@smlx smlx deleted the handle-conn-closed branch March 3, 2022 14:29
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.

1 participant