From 404f7f6094d72033700e3267cc4317a8e9653c53 Mon Sep 17 00:00:00 2001 From: Rui Chen Date: Sat, 24 Oct 2026 16:57:58 -0400 Subject: [PATCH] fix(db): release the Postgres startup probe client getDatabase checks a client out of the pool to fail fast on bad connection settings and never released it. That client stays checked out for the life of the process, leaving the pool one connection short, and Kysely's destroy() (pool.end()) would wait for it forever. Signed-off-by: Rui Chen --- lib/db.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/db.ts b/lib/db.ts index 8558458..b9e497e 100644 --- a/lib/db.ts +++ b/lib/db.ts @@ -141,7 +141,10 @@ export const getDatabase = createSingletonPromise(async () => { max: 10, }, ) - await pool.connect() + // Fail fast on bad connection settings, then hand the client back: a + // checked-out client keeps `pool.end()` (Kysely's `destroy()`) waiting forever. + const probe = await pool.connect() + probe.release() return new PostgresDialect({ pool,