mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 22:23:33 +01:00
PadMessageHandler: Parallelize client updates
Multiple clients are updated in parallel, but multiple revisions sent to a particular client are still sent sequentially.
This commit is contained in:
parent
770755debf
commit
14d4aadfe4
1 changed files with 4 additions and 4 deletions
|
@ -715,10 +715,10 @@ exports.updatePadClients = async (pad) => {
|
||||||
// but benefit of reusing cached revision object is HUGE
|
// but benefit of reusing cached revision object is HUGE
|
||||||
const revCache = {};
|
const revCache = {};
|
||||||
|
|
||||||
socket: for (const socket of roomSockets) {
|
await Promise.all(roomSockets.map(async (socket) => {
|
||||||
const sessioninfo = sessioninfos[socket.id];
|
const sessioninfo = sessioninfos[socket.id];
|
||||||
// The user might have disconnected since _getRoomSockets() was called.
|
// The user might have disconnected since _getRoomSockets() was called.
|
||||||
if (sessioninfo == null) continue;
|
if (sessioninfo == null) return;
|
||||||
|
|
||||||
while (sessioninfo.rev < pad.getHeadRevisionNumber()) {
|
while (sessioninfo.rev < pad.getHeadRevisionNumber()) {
|
||||||
const r = sessioninfo.rev + 1;
|
const r = sessioninfo.rev + 1;
|
||||||
|
@ -754,12 +754,12 @@ exports.updatePadClients = async (pad) => {
|
||||||
socket.json.send(msg);
|
socket.json.send(msg);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
messageLogger.error(`Failed to notify user of new revision: ${err.stack || err}`);
|
messageLogger.error(`Failed to notify user of new revision: ${err.stack || err}`);
|
||||||
continue socket;
|
return;
|
||||||
}
|
}
|
||||||
sessioninfo.time = currentTime;
|
sessioninfo.time = currentTime;
|
||||||
sessioninfo.rev = r;
|
sessioninfo.rev = r;
|
||||||
}
|
}
|
||||||
}
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue