From 57df605880598532b03ad1859b3f1bb97d422a95 Mon Sep 17 00:00:00 2001 From: Archkon <180910180+Archkon@users.noreply.github.com> Date: Mon, 29 Jun 2026 18:14:15 +0800 Subject: [PATCH] docs: clarify timer execution order after libuv 1.45.0 Explain that timers now run after poll in each event loop iteration, while libuv still runs timers once before uv_run() for UV_RUN_DEFAULT to preserve backwards compatibility. --- .../event-loop-timers-and-nexttick.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pages/asynchronous-work/event-loop-timers-and-nexttick.md b/pages/asynchronous-work/event-loop-timers-and-nexttick.md index df13a1e..6dd8f61 100644 --- a/pages/asynchronous-work/event-loop-timers-and-nexttick.md +++ b/pages/asynchronous-work/event-loop-timers-and-nexttick.md @@ -89,10 +89,12 @@ Between each run of the event loop, Node.js checks if it is waiting for any asynchronous I/O or timers and shuts down cleanly if there are not any. -Starting with libuv 1.45.0 (Node.js 20), the event loop behavior -changed to run timers only after the **poll** phase, instead of both before and after -as in earlier versions. This change can affect the timing of `setImmediate()` callbacks -and how they interact with timers in certain scenarios. +Starting with libuv 1.45.0 (Node.js 20), timers are run after the +**poll** phase in each event loop iteration. In earlier versions, timers +were run before polling. To preserve backwards compatibility, libuv +1.45.0 still runs timers once before entering the event loop . This change can affect the timing of +`setImmediate()` callbacks and how they interact with timers in certain +scenarios. ## Phases in Detail