mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Close db connections in helpers
This commit is contained in:
@@ -181,6 +181,8 @@ export function resetHabiticaDB() {
|
|||||||
members: [],
|
members: [],
|
||||||
}, (err) => {
|
}, (err) => {
|
||||||
if (err) return reject(err);
|
if (err) return reject(err);
|
||||||
|
|
||||||
|
db.close();
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -230,6 +232,7 @@ function _updateDocument(collectionName, doc, update, cb) {
|
|||||||
collection.update({ _id: doc._id }, { $set: update }, (err, result) => {
|
collection.update({ _id: doc._id }, { $set: update }, (err, result) => {
|
||||||
if (err) throw `Error updating ${collectionName}: ${err}`;
|
if (err) throw `Error updating ${collectionName}: ${err}`;
|
||||||
assign(doc, update);
|
assign(doc, update);
|
||||||
|
db.close();
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user