mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
API: Fix race conditions in setText
, appendText
, restoreRevision
This commit is contained in:
parent
cff089e54e
commit
d94f380141
2 changed files with 8 additions and 12 deletions
|
@ -13,6 +13,8 @@
|
||||||
* Fixed a potential attribute pool corruption bug with `copyPadWithoutHistory`.
|
* Fixed a potential attribute pool corruption bug with `copyPadWithoutHistory`.
|
||||||
* Mappings created by the `createGroupIfNotExistsFor` HTTP API are now removed
|
* Mappings created by the `createGroupIfNotExistsFor` HTTP API are now removed
|
||||||
from the database when the group is deleted.
|
from the database when the group is deleted.
|
||||||
|
* Fixed race conditions in the `setText`, `appendText`, and `restoreRevision`
|
||||||
|
functions (HTTP API).
|
||||||
|
|
||||||
#### For plugin authors
|
#### For plugin authors
|
||||||
|
|
||||||
|
|
|
@ -201,10 +201,8 @@ exports.setText = async (padID, text) => {
|
||||||
// get the pad
|
// get the pad
|
||||||
const pad = await getPadSafe(padID, true);
|
const pad = await getPadSafe(padID, true);
|
||||||
|
|
||||||
await Promise.all([
|
await pad.setText(text);
|
||||||
pad.setText(text),
|
await padMessageHandler.updatePadClients(pad);
|
||||||
padMessageHandler.updatePadClients(pad),
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -223,10 +221,8 @@ exports.appendText = async (padID, text) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const pad = await getPadSafe(padID, true);
|
const pad = await getPadSafe(padID, true);
|
||||||
await Promise.all([
|
await pad.appendText(text);
|
||||||
pad.appendText(text),
|
await padMessageHandler.updatePadClients(pad);
|
||||||
padMessageHandler.updatePadClients(pad),
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -559,10 +555,8 @@ exports.restoreRevision = async (padID, rev) => {
|
||||||
|
|
||||||
const changeset = builder.toString();
|
const changeset = builder.toString();
|
||||||
|
|
||||||
await Promise.all([
|
await pad.appendRevision(changeset);
|
||||||
pad.appendRevision(changeset),
|
await padMessageHandler.updatePadClients(pad);
|
||||||
padMessageHandler.updatePadClients(pad),
|
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue