mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
allow some operations to proceed in parallel
some code chunks previously used `async.parallel` but if you use `await` that forces them to be run serially. Instead, you can initiate the operation (getting a Promise) and then _later_ `await` the result of that Promise.
This commit is contained in:
parent
e7c2fad7b0
commit
769933786c
3 changed files with 37 additions and 21 deletions
|
@ -169,9 +169,8 @@ Pad.prototype.getInternalRevisionAText = async function getInternalRevisionAText
|
|||
|
||||
// get all needed data out of the database
|
||||
|
||||
// get the atext of the key revision
|
||||
let _atext = await db.getSub("pad:" + this.id + ":revs:" + keyRev, ["meta", "atext"]);
|
||||
let atext = Changeset.cloneAText(_atext);
|
||||
// start to get the atext of the key revision
|
||||
let p_atext = db.getSub("pad:" + this.id + ":revs:" + keyRev, ["meta", "atext"]);
|
||||
|
||||
// get all needed changesets
|
||||
let changesets = [];
|
||||
|
@ -181,6 +180,10 @@ Pad.prototype.getInternalRevisionAText = async function getInternalRevisionAText
|
|||
});
|
||||
}));
|
||||
|
||||
// we should have the atext by now
|
||||
let atext = await p_atext;
|
||||
atext = Changeset.cloneAText(atext);
|
||||
|
||||
// apply all changesets to the key changeset
|
||||
let apool = this.apool();
|
||||
for (let curRev = keyRev; curRev < targetRev; ) {
|
||||
|
@ -455,7 +458,10 @@ Pad.prototype.remove = async function remove() {
|
|||
// kick everyone from this pad
|
||||
padMessageHandler.kickSessionsFromPad(padID);
|
||||
|
||||
// delete all relations
|
||||
// delete all relations - the original code used async.parallel but
|
||||
// none of the operations except getting the group depended on callbacks
|
||||
// so the database operations here are just started and then left to
|
||||
// run to completion
|
||||
|
||||
// is it a group pad? -> delete the entry of this pad in the group
|
||||
if (padID.indexOf("$") >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue