From 35797e57fc16b53ac1567ac4591dce1eef5b76f8 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Sun, 18 Apr 2021 00:52:56 +0200 Subject: [PATCH] AuthorManager: await db.set in createAuthor --- src/node/db/AuthorManager.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/node/db/AuthorManager.js b/src/node/db/AuthorManager.js index 3fde1e4b1..d56ba2f10 100644 --- a/src/node/db/AuthorManager.js +++ b/src/node/db/AuthorManager.js @@ -156,13 +156,13 @@ async function mapAuthorWithDBKey(mapperkey, mapper) { // return the author return {authorID: author}; -} +}; /** * Internal function that creates the database entry for an author * @param {String} name The name of the author */ -exports.createAuthor = (name) => { +exports.createAuthor = async (name) => { // create the new author name const author = `a.${randomString(16)}`; @@ -174,8 +174,7 @@ exports.createAuthor = (name) => { }; // set the global author db entry - // NB: no await, since we're not waiting for the DB set to finish - db.set(`globalAuthor:${author}`, authorObj); + await db.set(`globalAuthor:${author}`, authorObj); return {authorID: author}; };