Skip to content

Commit

Permalink
Waiting for all requests to finish before closing q.
Browse files Browse the repository at this point in the history
  • Loading branch information
btakita committed May 13, 2019
1 parent 0526a1e commit d4c7299
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/api/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async function _export({
let match;
let pattern = /<a ([\s\S]+?)>/gm;

let promise;
const promises = [];

while (match = pattern.exec(cleaned)) {
const attrs = match[1];
Expand All @@ -183,12 +183,12 @@ async function _export({
const url = resolve(base.href, href);

if (url.protocol === protocol && url.host === host) {
promise = handle(url);
promises.push(handle(url));
}
}
}

await promise;
await Promise.all(promises);
}
}
}
Expand Down

0 comments on commit d4c7299

Please sign in to comment.