You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Returns the connection to the pool for reuse. Only call this when the connection is known to be in a clean state. If a transaction commit/rollback failed or the connection is otherwise suspect, call `destroy(reason)` instead.
102
+
* Register a hook to run immediately before the connection is released back to the pool.
103
+
* Hooks are invoked in registration order and awaited sequentially. If any hook throws,
104
+
* the connection is destroyed rather than returned to the pool, and the error propagates.
105
+
* Not invoked when `destroy()` is called directly.
* Returns the connection to the pool for reuse. Runs all registered release hooks first;
110
+
* if any hook throws the connection is destroyed and the error propagates. Only call this
111
+
* when the connection is known to be in a clean state. If a transaction commit/rollback
112
+
* failed or the connection is otherwise suspect, call `destroy(reason)` instead.
103
113
*/
104
114
release(): Promise<void>;
105
115
/**
106
-
* Evicts the connection so it is never reused. Call this when the connection may be in an indeterminate state (e.g. a failed rollback leaving an open transaction, or a broken socket).
116
+
* Evicts the connection so it is never reused. Call this when the connection may be in an
117
+
* indeterminate state (e.g. a failed rollback leaving an open transaction, or a broken socket).
107
118
*
108
-
* If teardown fails the error is propagated and the connection remains retryable, so the caller can decide whether to swallow the failure or retry cleanup. Calling destroy() or release() more than once after a successful teardown is caller error.
119
+
* If teardown fails the error is propagated and the connection remains retryable, so the caller
120
+
* can decide whether to swallow the failure or retry cleanup. Calling destroy() or release() more
121
+
* than once after a successful teardown is caller error.
109
122
*
110
-
* `reason` is advisory context only. It may be surfaced to driver-level observability hooks (e.g. pg-pool's `'release'` event) but does not influence eviction behavior and is not rethrown.
123
+
* `reason` is advisory context only. It may be surfaced to driver-level observability hooks
124
+
* (e.g. pg-pool's `'release'` event) but does not influence eviction behavior and is not rethrown.
111
125
*/
112
126
destroy(reason?: unknown): Promise<void>;
113
127
}
114
128
129
+
/**
130
+
* Restricted view of a {@link RuntimeConnection} passed to a {@link withConnection} callback.
131
+
* Exposes query execution and release-hook registration, but not the raw `release()` / `destroy()`
132
+
* lifecycle methods — those are managed by `withConnection` itself.
0 commit comments