Compare commits

..

No commits in common. "57abc1a1bbc9e3a89aadda69edb796ed4955af95" and "13e49d9a59a14de24ef775a9891527871544d642" have entirely different histories.

2 changed files with 5 additions and 17 deletions

View File

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

View File

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