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:
Richard Hansen 2020-09-16 21:06:15 -04:00 committed by John McLear
parent 45ec8326f0
commit 3365e944bf
8 changed files with 78 additions and 70 deletions

View file

@ -226,12 +226,12 @@ async function doImport(req, res, padId)
if (!req.directDatabaseAccess) {
if (importHandledByPlugin || useConvertor || fileIsHTML) {
try {
importHtml.setPadHTML(pad, text);
await importHtml.setPadHTML(pad, text);
} catch (e) {
apiLogger.warn("Error importing, possibly caused by malformed HTML");
}
} else {
pad.setText(text);
await pad.setText(text);
}
}