Replies: 1 comment 1 reply
-
Hi @dSalieri In the pending callbacks phase, Node.js executes I/O callbacks that were deferred to the next loop iteration. These are callbacks that couldn't be processed in the previous iteration and are thus handled later. In the poll phase, Node.js retrieves new I/O events and executes their callbacks, excluding close callbacks, those scheduled by timers, and setImmediate(). This is where most I/O operations' callbacks are executed. Node.js will also block and wait for new I/O events in this phase if necessary. The previous documentation combined these explanations, but the new documentation clearly separates them for better understanding. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The node.js documentation is very awesome and that's why I'm here :)
There are two places where the node.js documentation talks about executing I/O callbacks:
Previously, in the old version of the documentation it was like this:
Can anyone explain what's going on? And if in reality I/O callbacks are executed in two phases, please provide real code examples that describe this pattern.
It would also be nice (for anyone who understands the node.js source code) to have an explanation indicating the key lines of the source code (where the I/O callbacks are called, in what queue and when they are put, etc.)
I hope for an answer.
Beta Was this translation helpful? Give feedback.
All reactions