From 172bb6d9779a5c1f7c613b701d26b87fd3f91a28 Mon Sep 17 00:00:00 2001 From: Kishore <42832651+kishore03109@users.noreply.github.com> Date: Tue, 2 Apr 2024 18:59:21 +0800 Subject: [PATCH] fix(server): server should die if unable to connect to db (#1265) ## Problem something in me wanted to check if we indeed exit if we fail to connect to db, and the answer is... no [node.js](https://nodejs.org/docs/latest-v18.x/api/process.html#processexitcode_1) states that > A number which will be the process exit code, when the process either exits gracefully, or is exited via process.exit() without specifying a code. so it does not actually do the exiting, which leads to silent failures --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index 894dae598..454e56e6f 100644 --- a/src/server.js +++ b/src/server.js @@ -487,5 +487,5 @@ sequelize // If we cannot connect to the db, report an error using status code // And gracefully shut down the application since we can't serve client - process.exitCode = 1 + process.exit(1) })