From 7f78b403ae272e0ba8ff6c91b4f2c8e483dd657e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Rebours?= Date: Thu, 21 Oct 2021 11:08:48 +0200 Subject: [PATCH] WIP: use async functions from persistence module in datastore --- lib/datastore.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/datastore.js b/lib/datastore.js index c1788bd..57dccc6 100755 --- a/lib/datastore.js +++ b/lib/datastore.js @@ -610,12 +610,7 @@ class Datastore extends EventEmitter { // Update the datafile const updatedDocs = modifications.map(x => x.newDoc) - await new Promise((resolve, reject) => { - this.persistence.persistNewState(updatedDocs, err => { - if (err) return reject(err) - else resolve() - }) - }) + await this.persistence.persistNewStateAsync(updatedDocs) if (!options.returnUpdatedDocs) return { numAffected: numReplaced } else { let updatedDocsDC = []