Vertaa committeja

...

2 Commitit

Tekijä SHA1 Viesti Päivämäärä
Mattéo Delabre 57abc1a1bb
Forward fetch error message to user 2021-12-04 12:40:11 -05:00
Mattéo Delabre efb3ee1804
Fix exception pollution in retryable() 2021-12-04 12:39:55 -05:00
2 muutettua tiedostoa jossa 17 lisäystä ja 5 poistoa

Näytä tiedosto

@ -86,9 +86,20 @@ export const exclusive = (func, cooldown = 2000) =>
} }
else else
{ {
pending = pending pending = (async () =>
.then(() => sleep(cooldown)) {
.then(() => func(...args)); try
{
await pending;
}
catch
{
// Ignore errors from previous executions
}
await sleep(cooldown);
return func(...args);
})();
} }
return pending; return pending;

Näytä tiedosto

@ -54,7 +54,7 @@ ${cache[videoId][1]}…`);
} }
else if (cache[videoId][0] === statusError) else if (cache[videoId][0] === statusError)
{ {
res.status(500).send('Error'); res.status(500).send(`Error: ${cache[videoId][1]}`);
} }
else else
{ {
@ -86,7 +86,8 @@ ${cache[videoId][1]}…`);
catch (err) catch (err)
{ {
console.error(err); console.error(err);
cache[videoId] = [statusError]; console.log(`setting cache error to ${videoId}`)
cache[videoId] = [statusError, err.message];
} }
} }
}); });