🚑 Fix index calculation in task manager

This commit is contained in:
C-3PO 2018-11-16 04:37:45 +01:00
parent 0789fa0451
commit bbbc2510f5
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -13,8 +13,8 @@ export default function taskManager(tasks: Array<() => Promise<void>>, maxConcur
}
} else {
//If there is at least one task left, complete it
const curTask = remainingTasks.shift() as () => Promise<void>;
const curTaskIndex = origLength - remainingTasks.length;
const curTask = remainingTasks.shift() as () => Promise<void>;
currentlyRunningTasks += 1;
curTask().then(function(...result) {
returnValues[curTaskIndex] = result;