From e197a35baefcf4482c3600a71239e37efd6c8c12 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 9 May 2026 19:06:45 +0200 Subject: [PATCH] Fix max pool in session mode --- backend/api/package.json | 2 +- backend/shared/src/supabase/init.ts | 38 ++++++++++++++--------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/backend/api/package.json b/backend/api/package.json index dc673e2a..d3aa42c3 100644 --- a/backend/api/package.json +++ b/backend/api/package.json @@ -1,6 +1,6 @@ { "name": "@compass/api", - "version": "1.37.0", + "version": "1.37.1", "private": true, "description": "Backend API endpoints", "main": "src/serve.ts", diff --git a/backend/shared/src/supabase/init.ts b/backend/shared/src/supabase/init.ts index 7b431401..90e26896 100644 --- a/backend/shared/src/supabase/init.ts +++ b/backend/shared/src/supabase/init.ts @@ -77,14 +77,14 @@ const newClient = ( ...settings, } : { - // Default: connect to Supabase's pooled Postgres + // Default: connect to Supabase's Postgres // This host is IPV4 compatible, for the google cloud VM host: 'aws-1-us-west-1.pooler.supabase.com', - port: 5432, + port: 6543, // transaction mode user: `postgres.${instanceId}`, password: password, database: 'postgres', - pool_mode: 'session', + // pool_mode: 'session', // This line is ignored by pg-promise/node-postgres anyway ssl: {rejectUnauthorized: false}, family: 4, // <- forces IPv4 ...settings, @@ -125,20 +125,20 @@ export function createSupabaseDirectClient(password?: string) { return (pgpDirect = client) } -let shortTimeoutPgpClient: IDatabase | null = null -export const createShortTimeoutDirectClient = () => { - if (shortTimeoutPgpClient) return shortTimeoutPgpClient - shortTimeoutPgpClient = newClient({ - instanceId: getInstanceId(), - password: getSupabasePwd(), - query_timeout: 1000 * 30, - max: 20, - }) - return shortTimeoutPgpClient -} +// let shortTimeoutPgpClient: IDatabase | null = null +// export const createShortTimeoutDirectClient = () => { +// if (shortTimeoutPgpClient) return shortTimeoutPgpClient +// shortTimeoutPgpClient = newClient({ +// instanceId: getInstanceId(), +// password: getSupabasePwd(), +// query_timeout: 1000 * 30, +// max: 20, +// }) +// return shortTimeoutPgpClient +// } -export const SERIAL_MODE = new pgp.txMode.TransactionMode({ - tiLevel: pgp.txMode.isolationLevel.serializable, - readOnly: false, - deferrable: false, -}) +// export const SERIAL_MODE = new pgp.txMode.TransactionMode({ +// tiLevel: pgp.txMode.isolationLevel.serializable, +// readOnly: false, +// deferrable: false, +// })