mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-22 22:26:19 +00:00
esperar entre pedidos fallidso
This commit is contained in:
parent
3c9788647b
commit
df845acc66
1 changed files with 5 additions and 0 deletions
|
@ -33,6 +33,7 @@ export async function downloadList(path: string) {
|
|||
async (urlS) => {
|
||||
let res: ScrapResult = { type: "skipped" };
|
||||
for (let attempts = 0; attempts < 3; attempts++) {
|
||||
if (attempts !== 0) await wait(1500);
|
||||
res = await scrap(urlS);
|
||||
if (res.type === "done" || res.type === "skipped") {
|
||||
break;
|
||||
|
@ -101,3 +102,7 @@ async function scrap(urlS: string): Promise<ScrapResult> {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
function wait(ms: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue