mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-10 01:56:15 +08:00
stackless-async-context.ts woke two concurrent workers from 2 ms and 1 ms timers. The deadlines were taken when each worker scheduled its timer, so on a slow build both could be due on the same tick in either order. Those workers now wake from gates that chained timer callbacks open one per turn in a fixed order. Each woken body still crosses a timer and nested awaits with its own AsyncLocalStorage context. The sequential chain workers keep one pending timer at a time. stackless-async-ordering.ts scheduled setTimeout(0) and setImmediate from the main module, where Node leaves their order to timing; the lines never printed only because main finished first. Main now awaits a timer whose callback schedules the immediate, a microtask and a tick, so the macrotask order is pinned and printed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>