The following loop controls the number of pending promises returned by mapper.
for (let i = 0; i < concurrency; i++) { next(); if (isIterableDone) { break; } }.
However, if concurrency has a decimal value (for instance, if concurrency = 2.5), there will be 3 pending promises because the loop allows one more iteration to happen (the case in which i=2).
Is this a bug or it is actually intentional? Shouldn't we avoid such cases? If so, the bug could potentially be fixed by adding a condition when validating the value of concurrency.
The following loop controls the number of pending promises returned by
mapper
.for (let i = 0; i < concurrency; i++) { next(); if (isIterableDone) { break; } }
.However, if
concurrency
has a decimal value (for instance, ifconcurrency = 2.5
), there will be 3 pending promises because the loop allows one more iteration to happen (the case in whichi=2
).Is this a bug or it is actually intentional? Shouldn't we avoid such cases? If so, the bug could potentially be fixed by adding a condition when validating the value of
concurrency
.