pgx
pgx copied to clipboard
Custom context canceled
Allow customizing context canceled behavior for pgconn. This allows alternative behavior to simply closing a connection with a deadline. DeadlineContextWatcherHandler allows granting a grace period before closing the connection. CancelRequestContextWatcherHandler tries to cancel the request first.
This can avoid the churn of connections being established and closed when frequently canceling contexts for queries.
The existing default behavior is unchanged.