mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-24 09:26:14 -04:00
async-ify more functions, and await completion
Where feasible I put the await at the end of the function to minimize the impact on latency. My motivation for this change: Eliminate a race condition in tests I am writing.
This commit is contained in:
parent
45ec8326f0
commit
3365e944bf
8 changed files with 78 additions and 70 deletions
|
@ -22,8 +22,7 @@ const rehype = require("rehype")
|
|||
const format = require("rehype-format")
|
||||
|
||||
|
||||
exports.setPadHTML = function(pad, html)
|
||||
{
|
||||
exports.setPadHTML = async (pad, html) => {
|
||||
var apiLogger = log4js.getLogger("ImportHtml");
|
||||
|
||||
var opts = {
|
||||
|
@ -103,6 +102,8 @@ exports.setPadHTML = function(pad, html)
|
|||
var theChangeset = builder.toString();
|
||||
|
||||
apiLogger.debug('The changeset: ' + theChangeset);
|
||||
pad.setText("\n");
|
||||
pad.appendRevision(theChangeset);
|
||||
await Promise.all([
|
||||
pad.setText('\n'),
|
||||
pad.appendRevision(theChangeset),
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue