From 9a4b7b74d6165f5f7e135dac6e434f0f5a5f1f91 Mon Sep 17 00:00:00 2001 From: Fahad Faruqi Date: Tue, 25 Jun 2024 22:48:37 -0400 Subject: [PATCH] removing remnants of timeout --- database/db.ts | 2 +- server.ts | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/database/db.ts b/database/db.ts index 42a3ac3..c6abb18 100644 --- a/database/db.ts +++ b/database/db.ts @@ -5,7 +5,7 @@ import client from './db.config'; // if no connection can be made, return null const getDB = async () => { console.log("Connecting to Database ..."); - if(client._connected) return client; + if(client._connected || client._connecting) return client; try{ await client.connect() console.log("Connected to Database"); diff --git a/server.ts b/server.ts index e59eb83..0d68eb6 100644 --- a/server.ts +++ b/server.ts @@ -13,15 +13,12 @@ import fs from 'fs'; // const credentials = {key: privateKey, cert: certificate}; const PORT = 3000; -// const INTERVAL = secondsToMs(10); // 1 hr -// const TIMEOUT = secondsToMs(10); const app = express(); let dbAval: boolean = true; // initial check (async () => { try { - // logger.info(`Please wait ${TIMEOUT / 1000}s for the database to connect`); dbAval = await checkDB(); logger.info(`Server is up, database is ${dbAval ? "up" : "not up"}`); } catch (e: any) {