Repository navigation
Retry listen reconnect when the first attempt fails - #1286
Merged
Merged
Conversation
Owner
|
Thank you ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1285
When the listener connection drops,
onclosecallsstart(name)for each channel and ignores the rejection. If that first reconnect attempt fails (server still restarting, login refused), nothing schedules another attempt, soonlistenis never called again and notifications are lost.This moves the re-listen into
relisten(). On failure it retries afteroptions.backoff(retries)seconds, and stops onceend()is called or the channel is unlistened.end()clears pending timers.Test: new case in
tests/listen.jsmakes the reconnect fail by setting the role tonologin, terminating the backend, then allowing login again. It expectsonlistento run a second time and a notification to arrive. Full CI matrix passes on my fork (Node 18-24 x PostgreSQL 13-18).