-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: listener retries with exponential backoff #3536
fix: listener retries with exponential backoff #3536
Conversation
Really puzzled by this error that only happens on CI, not locally:
Whenever io tests fail, they're really hard to debug. |
It's like something is calling The only place that's done is here: Lines 1220 to 1222 in 1ad6dc6
Managed to reproduce the error locally, the only related db logs:
|
That was it, I just skipped this test: Lines 1212 to 1226 in 4416050
And the tests no longer fail. The thing that has changed in this PR is that the I think this can be fixed by isolating Fixed on #3537 |
d3d8499
to
b95f55c
Compare
Also corrects the admin ready response which now considers the listener state.
b95f55c
to
5c51bd7
Compare
Clears the limitation mentioned on PostgREST#3536 The Listener no longer uses the https://hackage.haskell.org/package/retry package and instead uses a much simpler IORef in AppState for the delays. Additionally it no longer uses exception throwing/catching, which is rather messy and brings some concerns(PostgREST#3569 (comment)).
Clears the limitation mentioned on #3536 The Listener no longer uses the https://hackage.haskell.org/package/retry package and instead uses a much simpler IORef in AppState for the delays. Additionally it no longer uses exception throwing/catching, which is rather messy and brings some concerns(#3569 (comment)).
Continues #3533
Now it works like:
Limitation
Once the listen channel is recovered, the retry status is not reset. So if the last backoff was 4 seconds, the next time recovery kicks in the backoff will be 8 seconds. If a recovery reaches 32 seconds, the backoff will stay there.
This is a problem with the interaction between
hasql-notifications
andretry
. TheHasql.Notifications.waitForNotifications
uses a forever loop that only finishes when it throws an exception, retry recovers on an exception and succeeds (here it restarts the retry status) when the function finishes .I've left this as a TODO for now, it's still better than retrying without backoff.