From 292a37397d48146d27d65237b2f98a077529bac6 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Thu, 2 Apr 2026 21:50:12 +0100 Subject: [PATCH] refactor: streamline database connection logic in app initialization --- App/Index.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/App/Index.ts b/App/Index.ts index 6eaf70e462..7a89cf9ef4 100755 --- a/App/Index.ts +++ b/App/Index.ts @@ -79,6 +79,17 @@ const init: PromiseVoidFunction = async (): Promise => { }); }; + // Connect to Postgres database + await PostgresAppInstance.connect(); + + // Connect to Redis + await Redis.connect(); + + // Connect to Clickhouse database + await ClickhouseAppInstance.connect( + ClickhouseAppInstance.getDatasourceOptions(), + ); + // Initialize the app with service name and status checks await App.init({ appName: APP_NAME, @@ -91,16 +102,7 @@ const init: PromiseVoidFunction = async (): Promise => { }, }); - // Connect to Postgres database - await PostgresAppInstance.connect(); - // Connect to Redis - await Redis.connect(); - - // Connect to Clickhouse database - await ClickhouseAppInstance.connect( - ClickhouseAppInstance.getDatasourceOptions(), - ); // Initialize real-time functionalities await Realtime.init();