mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
remove promise.all from closeDatabaseHelper
This commit is contained in:
@@ -14,7 +14,7 @@ export const initDatabaseHelper = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
await mongoose.connect(mongoURL);
|
await mongoose.connect(mongoURL);
|
||||||
|
|
||||||
// allow empty strings to pass the required validator
|
// allow empty strings to pass the required validator
|
||||||
mongoose.Schema.Types.String.checkRequired(v => typeof v === "string");
|
mongoose.Schema.Types.String.checkRequired(v => typeof v === "string");
|
||||||
|
|
||||||
@@ -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");
|
};
|
||||||
}
|
|
||||||
}),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user