From 32806c31fd003ca94cf512a56fdba6d7ef214502 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Fri, 18 Jun 2021 12:23:32 +0200 Subject: [PATCH] Pad: drop one Promise.all call as `saveToDatabase` and `addPad` already use await --- src/node/db/Pad.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index db35daf19..30cd22d99 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -92,15 +92,11 @@ Pad.prototype.appendRevision = async function (aChangeset, author) { newRevData.meta.atext = this.atext; } - const p = [ - db.set(`pad:${this.id}:revs:${newRev}`, newRevData), - this.saveToDatabase(), - ]; + this.saveToDatabase(); + const p_newRevData = db.set(`pad:${this.id}:revs:${newRev}`, newRevData); // set the author to pad - if (author) { - p.push(authorManager.addPad(author, this.id)); - } + if (author) authorManager.addPad(author, this.id); if (this.head === 0) { hooks.callAll('padCreate', {pad: this, author}); @@ -108,7 +104,7 @@ Pad.prototype.appendRevision = async function (aChangeset, author) { hooks.callAll('padUpdate', {pad: this, author, revs: newRev, changeset: aChangeset}); } - await Promise.all(p); + await p_newRevData; }; // save all attributes to the database