mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 16:36:15 -04:00
Pad: Limit DB concurrency when copying a pad
This commit is contained in:
parent
8442e002f9
commit
096379e6f9
2 changed files with 5 additions and 2 deletions
|
@ -383,13 +383,14 @@ class Pad {
|
|||
await db.set(`pad:${destinationID}${keySuffix}`, val);
|
||||
};
|
||||
|
||||
await Promise.all((function* () {
|
||||
const promises = (function* () {
|
||||
yield copyRecord('');
|
||||
yield* Stream.range(0, this.head + 1).map((i) => copyRecord(`:revs:${i}`));
|
||||
yield* Stream.range(0, this.chatHead + 1).map((i) => copyRecord(`:chat:${i}`));
|
||||
yield this.copyAuthorInfoToDestinationPad(destinationID);
|
||||
if (destGroupID) yield db.setSub(`group:${destGroupID}`, ['pads', destinationID], 1);
|
||||
}).call(this));
|
||||
}).call(this);
|
||||
for (const p of new Stream(promises).batch(100).buffer(99)) await p;
|
||||
|
||||
// Initialize the new pad (will update the listAllPads cache)
|
||||
const dstPad = await padManager.getPad(destinationID, null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue