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

View File

@ -1,7 +1,6 @@
name: "Check Backend Pull Request"
on:
workflow_dispatch: # remove me
pull_request:
types: [opened, synchronize]
paths:

View File

@ -5,11 +5,6 @@ export const initDatabase = (MONGO_URL: string) => {
mongoose
.connect(MONGO_URL)
.then(() => console.log('Successfully connected to DB'))
.catch((e) => {
console.log('Failed to connect to DB ', e);
setTimeout(() => {
console.log(e);
}, 5000);
});
.catch((e) => console.log('Failed to connect to DB ', e));
return mongoose.connection;
};

View File

@ -6,14 +6,14 @@ export const setUpHealthEndpoint = <T>(server: T) => {
const onSignal = () => {
console.log('Server is starting clean-up');
return Promise.all([
() => {
new Promise((resolve) => {
if (mongoose.connection && mongoose.connection.readyState == 1) {
mongoose.connection.close();
() => {
console.info('Database connection closed');
};
mongoose.connection.close()
.then(() => resolve('Database connection closed'));
} else {
resolve('Database connection already closed');
}
}
})
]);
};