Merge pull request #265 from discordeno/max-stack

Max stack
This commit is contained in:
Skillz4Killz
2020-12-16 14:30:28 -05:00
committed by GitHub

View File

@@ -62,8 +62,7 @@ async function cleanupQueues() {
}
async function processQueue() {
// Putting this code inside a function like this allows us to use tail recursion like a while loop without hitting the max stack error.
async function avoidMaxStackError() {
while (queueInProcess) {
if (
(Object.keys(pathQueues).length) && !globallyRateLimited
) {
@@ -110,12 +109,9 @@ async function processQueue() {
}
if (Object.keys(pathQueues).length) {
avoidMaxStackError();
cleanupQueues();
} else queueInProcess = false;
}
return avoidMaxStackError();
}
processRateLimitedPaths();