mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
db: await more database operations
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
This commit is contained in:
parent
e64462323b
commit
0040f5984e
3 changed files with 19 additions and 21 deletions
|
@ -41,8 +41,10 @@ exports.getReadOnlyId = async (padId) => {
|
|||
// there is no readOnly Entry in the database, let's create one
|
||||
if (readOnlyId == null) {
|
||||
readOnlyId = `r.${randomString(16)}`;
|
||||
db.set(`pad2readonly:${padId}`, readOnlyId);
|
||||
db.set(`readonly2pad:${readOnlyId}`, padId);
|
||||
await Promise.all([
|
||||
db.set(`pad2readonly:${padId}`, readOnlyId),
|
||||
db.set(`readonly2pad:${readOnlyId}`, padId),
|
||||
]);
|
||||
}
|
||||
|
||||
return readOnlyId;
|
||||
|
@ -52,7 +54,7 @@ exports.getReadOnlyId = async (padId) => {
|
|||
* returns the padId for a read only id
|
||||
* @param {String} readOnlyId read only id
|
||||
*/
|
||||
exports.getPadId = (readOnlyId) => db.get(`readonly2pad:${readOnlyId}`);
|
||||
exports.getPadId = async (readOnlyId) => await db.get(`readonly2pad:${readOnlyId}`);
|
||||
|
||||
/**
|
||||
* returns the padId and readonlyPadId in an object for any id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue