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
{{ message }}
Repository navigation
Abort reserve() and begin() leases with an AbortSignal #10
On serverless platforms that keep an instance warm between invocations (for example Vercel fluid compute), an invocation can end or be cut off in the middle of sql.reserve() or sql.begin(). The lease is never released, so the connection stays reserved for the life of the instance and the pool can run out of connections.
Proposal
Accept an AbortSignal on reserve() and begin(). Aborting discards the lease: the connection is terminated, so the server rolls back any open transaction, and later statements on the handle reject with a new LEASE_ABORTED code.
In the lease code this is settle(l, Lease.Discarded).
Open questions
The begin() signature: begin({ mode, signal }, fn) or begin(mode, fn, { signal }).
Whether to add a pool-wide lease_timeout as a backstop for a forgotten release(), or rely on signal only.
Activity