fix: ensure Listener connections are released

retryingListen function potentially leaks database connections. This patch ensures the connections are released in case of listen/notify errors.
This commit is contained in:
Michal Kleczek
2026-01-26 16:26:24 -05:00
committed by GitHub
parent d75b1a7e96
commit 00c7cb1a22
3 changed files with 33 additions and 16 deletions
+3
View File
@@ -50,6 +50,7 @@ data Observation
| DBListenBugHint -- https://github.com/PostgREST/postgrest/issues/3147
| DBListenerGotSCacheMsg ByteString
| DBListenerGotConfigMsg ByteString
| DBListenerConnectionCleanupFail SomeException
| QueryObs MainQuery Status
| ConfigReadErrorObs SQL.UsageError
| ConfigInvalidObs Text
@@ -122,6 +123,8 @@ observationMessage = \case
"Received a schema cache reload message on the " <> show channel <> " channel"
DBListenerGotConfigMsg channel ->
"Received a config reload message on the " <> show channel <> " channel"
DBListenerConnectionCleanupFail ex ->
"Failed during listener connection cleanup: " <> showOnSingleLine '\t' (show ex)
QueryObs{} ->
mempty -- TODO pending refactor: The logic for printing the query cannot be done here. Join the observationMessage function into observationLogger to avoid this mempty.
ConfigReadErrorObs usageErr ->