{{ message }}
Repository navigation
Conversation
PriorityQueue#peekBottom() returned the last slot of the heap, which is not necessarily the largest element, so MockTimers#runAll() could stop before the timer that fires last. Scan the leaves of the heap for the largest element instead. Assisted-by: a closed-source coding agent Signed-off-by: Yarchik <spoko.dev@gmail.com>
Collaborator
Contributor
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.

What?
Fixes
t.mock.timers.runAll()skipping the longest timer when it's scheduled before shorter ones.For example, timers scheduled at 9999, 8888, and 8888 ms only execute the two shorter callbacks.
Why?
PriorityQueue#peekBottom()returns the last element of the heap, which isn't necessarily the largest.How?
Update
peekBottom()to find the largest element among the heap's leaves.Added a regression test based on the existing documentation example.
test/parallel/test-runner-mock-timers.jspasses (62/62) with the fix, and the new test fails without it. I ran it against a nightly build with the changed files loaded, not a full local build. ESLint passes on the changed files.AI assistance was used to investigate and implement the fix. I reviewed the changes and test results.