Files
bun.sh/test/regression
Claude Bot b176d23a9d fix(timers): ensure all ready timers fire before setImmediate callbacks
When multiple setTimeout timers are scheduled to fire at the same time
(same millisecond), they should all execute before any setImmediate
callbacks that were scheduled by those timer callbacks. This matches
Node.js behavior.

The bug occurred because the timer readiness check in `drainTimers()`
used full nanosecond precision, while the timer heap ordering uses
millisecond-truncated precision for JavaScript timers. This meant two
timers scheduled within the same millisecond could have different
nanosecond values, causing one to be considered "in the future" even
though both should fire together.

The fix aligns the timer readiness check with the heap ordering by
truncating to millisecond precision for JavaScript timers.

Fixes #26508

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 20:36:31 +00:00
..