-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
riverpgxv5: hijack raw listener conn to assume control
The previous implementation of the driver would `Acquire()` a conn from the `pgxpool.Pool`, but keep the pool in control of the conn. This meant that the pool would still do its regular maintenance checks on the conn, such as closing it after it had reached its max lifetime. This isn't actually desirable in the case of a `LISTEN` listener—we want the listener to stay alive as long as possible and to avoid missing any notifications. We perform our own health checks on the conn in the form of periodic pings, which should be sufficient to make sure the conn is still connected and functioning properly. As such, adjust the driver so that it calls `Hijack()` on the conn immediately after acquiring it, assuming full control of it from the underlying pool. The listener is still responsible for closing the conn at shutdown. Fixes #660.
- Loading branch information
Showing
2 changed files
with
14 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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