mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-22 15:15:19 +00:00
Fix export race condition (#585)
* Await all items in the export queue before killing server
This commit is contained in:
@@ -163,7 +163,6 @@ async function _export({
|
|||||||
const cleaned = clean_html(body);
|
const cleaned = clean_html(body);
|
||||||
|
|
||||||
const q = yootils.queue(8);
|
const q = yootils.queue(8);
|
||||||
let promise;
|
|
||||||
|
|
||||||
const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
|
const base_match = /<base ([\s\S]+?)>/m.exec(cleaned);
|
||||||
const base_href = base_match && get_href(base_match[1]);
|
const base_href = base_match && get_href(base_match[1]);
|
||||||
@@ -180,12 +179,12 @@ async function _export({
|
|||||||
const url = resolve(base.href, href);
|
const url = resolve(base.href, href);
|
||||||
|
|
||||||
if (url.protocol === protocol && url.host === host) {
|
if (url.protocol === protocol && url.host === host) {
|
||||||
promise = q.add(() => handle(url));
|
q.add(() => handle(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await promise;
|
await q.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user