Skip to content

Commit

Permalink
AuthorManager: await db.set in createAuthor
Browse files Browse the repository at this point in the history
  • Loading branch information
webzwo0i authored and rhansen committed Apr 20, 2021
1 parent 20c512c commit 35797e5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/node/db/AuthorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`;

Expand All @@ -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};
};
Expand Down

0 comments on commit 35797e5

Please sign in to comment.