correct exponential backoff on Listener

Clears the limitation mentioned on

https://github.com/PostgREST/postgrest/pull/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(https://github.com/PostgREST/postgrest/issues/3569#issuecomment-2146013327).
This commit is contained in:
steve-chavez
2024-06-05 08:52:18 -05:00
committed by Steve Chavez
parent aaf2d2e430
commit 1a8b6972a8
3 changed files with 50 additions and 59 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ postgrest logLevel appState connWorker =
-- the connWorker is done.
when (isServiceUnavailable response) connWorker
resp <- do
delay <- AppState.getRetryNextIn appState
delay <- AppState.getNextDelay appState
return $ addRetryHint delay response
respond resp