remove promise.all from closeDatabaseHelper

This commit is contained in:
Maidul Islam
2023-10-17 12:24:18 +01:00
parent fb7c7045e9
commit b1d16cab39
+7 -11
View File
@@ -31,14 +31,10 @@ export const initDatabaseHelper = async ({
* Close database conection * Close database conection
*/ */
export const closeDatabaseHelper = async () => { export const closeDatabaseHelper = async () => {
return Promise.all([ if (mongoose.connection && mongoose.connection.readyState === 1) {
new Promise((resolve) => { await mongoose.connection.close();
if (mongoose.connection && mongoose.connection.readyState == 1) { return "Database connection closed";
mongoose.connection.close() } else {
.then(() => resolve("Database connection closed")); return "Database connection already closed";
} else { }
resolve("Database connection already closed"); };
}
}),
]);
}