Skip to content

Commit

Permalink
fix(server): server should die if unable to connect to db (#1265)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
kishore03109 authored Apr 2, 2024
1 parent d440441 commit 172bb6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

0 comments on commit 172bb6d

Please sign in to comment.