From ccb5f1e6903394dcd7ac138c76623daadbe66cb7 Mon Sep 17 00:00:00 2001 From: Waleed Date: Thu, 23 Apr 2026 23:31:52 -0700 Subject: [PATCH] fix(db): revert statement_timeout startup options breaking pooled connections (#4284) --- apps/realtime/src/database/operations.ts | 7 ------- packages/db/index.ts | 15 --------------- 2 files changed, 22 deletions(-) diff --git a/apps/realtime/src/database/operations.ts b/apps/realtime/src/database/operations.ts index 2a0bf28d91c..9e2b4d1ddbe 100644 --- a/apps/realtime/src/database/operations.ts +++ b/apps/realtime/src/database/operations.ts @@ -23,10 +23,6 @@ import { env } from '@/env' const logger = createLogger('SocketDatabase') const connectionString = env.DATABASE_URL -/** - * Server-side safety net for runaway queries and abandoned transactions. - * See `packages/db/index.ts` for rationale. - */ const socketDb = drizzle( postgres(connectionString, { prepare: false, @@ -34,9 +30,6 @@ const socketDb = drizzle( connect_timeout: 20, max: 30, onnotice: () => {}, - connection: { - options: '-c statement_timeout=90000 -c idle_in_transaction_session_timeout=90000', - }, }), { schema } ) diff --git a/packages/db/index.ts b/packages/db/index.ts index bc77b234a61..186b076abaf 100644 --- a/packages/db/index.ts +++ b/packages/db/index.ts @@ -10,27 +10,12 @@ if (!connectionString) { throw new Error('Missing DATABASE_URL environment variable') } -/** - * Server-side safety net for runaway queries and abandoned transactions: - * - `statement_timeout=90000` kills any single statement still running - * after 90s. Protects against pathological queries. - * - `idle_in_transaction_session_timeout=90000` kills a session that has - * opened a transaction and gone idle for 90s. Protects against - * transactions that hold row locks while waiting on external I/O. - * - * These are last-resort caps — application code should never approach - * them. Migrations or admin scripts that legitimately need longer limits - * must construct their own client with overrides. - */ const postgresClient = postgres(connectionString, { prepare: false, idle_timeout: 20, connect_timeout: 30, max: 30, onnotice: () => {}, - connection: { - options: '-c statement_timeout=90000 -c idle_in_transaction_session_timeout=90000', - }, }) export const db = drizzle(postgresClient, { schema })