From 76c4a5ef9648a20ffdbd5847093b2e4b6567461f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 19 May 2026 11:16:09 +0000 Subject: [PATCH] Use exponential backoff and tighten connection error detection Agent-Logs-Url: https://github.com/gabriel20xx/CollabTable/sessions/2bd9068b-15e3-43bb-81b9-94b4fb93bfdc Co-authored-by: gabriel20xx <21219769+gabriel20xx@users.noreply.github.com> --- CollabTableServer/src/db.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CollabTableServer/src/db.ts b/CollabTableServer/src/db.ts index 84650f4..c891139 100644 --- a/CollabTableServer/src/db.ts +++ b/CollabTableServer/src/db.ts @@ -307,14 +307,13 @@ export async function initializeDatabase() { const isConnectionError = err?.code === 'ECONNREFUSED' || err?.code === 'ENOTFOUND' || - err?.code === 'ETIMEDOUT' || - err?.message?.includes('connect'); + err?.code === 'ETIMEDOUT'; if (!isConnectionError || attempt === maxRetries) { throw err; } - const delay = retryDelayMs * attempt; + const delay = retryDelayMs * Math.pow(2, attempt - 1); console.warn( `Database connection attempt ${attempt}/${maxRetries} failed (${err.code || err.message}). Retrying in ${delay}ms...` );