Fix export race condition (#585)

* Await all items in the export queue before killing server
This commit is contained in:
halfnelson
2019-03-04 20:21:30 +10:00
committed by Conduitry
parent 411e2594af
commit b5edf0edd5

View File

@@ -163,7 +163,6 @@ async function _export({
const cleaned = clean_html(body);
const q = yootils.queue(8);
let promise;
const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
const base_href = base_match && get_href(base_match[1]);
@@ -180,12 +179,12 @@ async function _export({
const url = resolve(base.href, href);
if (url.protocol === protocol && url.host === host) {
promise = q.add(() => handle(url));
q.add(() => handle(url));
}
}
}
await promise;
await q.close();
}
}
}