Repository navigation
fix(queue): return empty arrays for empty batches - #2115
Open
sricharanreddycheruku wants to merge 1 commit into
Open
sricharanreddycheruku wants to merge 1 commit into
sricharanreddycheruku wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Promise.all(q.pushAsync(tasks))throws whentasksis empty and the queue is idle, because the empty-batch path returnsundefined. The same call returns an empty array while the queue has pending work.Return an empty array from that early path in
push,unshift,pushAsync, andunshiftAsync. This keeps the array result consistent with nonempty batches and preserves the existing deferred drain event.The regression tests cover idle and paused queues, including cargo, cargoQueue, and priorityQueue. All 14 new cases fail before the fix. Local checks passed on Node 18.20.8, 20.20.0, and 21.7.3, with 717 tests on each.
npm testalso passed lint on Node 20.The Firefox 157.0.1 browser suite passed all 705 tests on Node 20. The coverage command also passed.
Independent validation on Windows Node 22: 18 focused regression and drain checks passed. Full Windows Node 20 CI and upstream CI have not run locally. git diff --check passed.