pgx icon indicating copy to clipboard operation
pgx copied to clipboard

Custom context canceled

Open jackc opened this issue 1 year ago • 0 comments

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.

jackc avatar Feb 04 '24 04:02 jackc