Align with comments

This commit is contained in:
Reginald Bondoc
2022-12-21 20:32:38 +01:00
parent 75e3a3b2d6
commit a3609b9b6f
3 changed files with 7 additions and 13 deletions
@@ -1,7 +1,6 @@
name: "Check Backend Pull Request" name: "Check Backend Pull Request"
on: on:
workflow_dispatch: # remove me
pull_request: pull_request:
types: [opened, synchronize] types: [opened, synchronize]
paths: paths:
+1 -6
View File
@@ -5,11 +5,6 @@ export const initDatabase = (MONGO_URL: string) => {
mongoose mongoose
.connect(MONGO_URL) .connect(MONGO_URL)
.then(() => console.log('Successfully connected to DB')) .then(() => console.log('Successfully connected to DB'))
.catch((e) => { .catch((e) => console.log('Failed to connect to DB ', e));
console.log('Failed to connect to DB ', e);
setTimeout(() => {
console.log(e);
}, 5000);
});
return mongoose.connection; return mongoose.connection;
}; };
+6 -6
View File
@@ -6,14 +6,14 @@ export const setUpHealthEndpoint = <T>(server: T) => {
const onSignal = () => { const onSignal = () => {
console.log('Server is starting clean-up'); console.log('Server is starting clean-up');
return Promise.all([ return Promise.all([
() => { new Promise((resolve) => {
if (mongoose.connection && mongoose.connection.readyState == 1) { if (mongoose.connection && mongoose.connection.readyState == 1) {
mongoose.connection.close(); mongoose.connection.close()
() => { .then(() => resolve('Database connection closed'));
console.info('Database connection closed'); } else {
}; resolve('Database connection already closed');
} }
} })
]); ]);
}; };