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