Clamp and validate DB_CONNECT_RETRIES and DB_CONNECT_RETRY_DELAY_MS env vars

Agent-Logs-Url: https://github.com/gabriel20xx/CollabTable/sessions/3d38d5f2-ce12-45a3-bcfe-9fb96f3581ce

Co-authored-by: gabriel20xx <21219769+gabriel20xx@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-19 11:23:06 +00:00
committed by GitHub
co-authored by gabriel20xx
parent 76c4a5ef96
commit 09ae5309d4
+5 -2
View File
@@ -296,8 +296,11 @@ export const dbAdapter: DBAdapter = clientType === 'postgres' || clientType ===
: new SqliteAdapter();
export async function initializeDatabase() {
const maxRetries = parseInt(process.env.DB_CONNECT_RETRIES || '10', 10);
const retryDelayMs = parseInt(process.env.DB_CONNECT_RETRY_DELAY_MS || '3000', 10);
const parsedRetries = parseInt(process.env.DB_CONNECT_RETRIES || '10', 10);
const maxRetries = Number.isNaN(parsedRetries) || parsedRetries < 1 ? 10 : parsedRetries;
const parsedDelay = parseInt(process.env.DB_CONNECT_RETRY_DELAY_MS || '3000', 10);
const retryDelayMs = Number.isNaN(parsedDelay) || parsedDelay < 0 ? 3000 : parsedDelay;
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {