Vipul Patel
Aug 31, 2018 · 1 min read

Great Article and Let them coming, greedy………lol

Am I getting it wrong on what exactly “tick” means

According to the link “one tick” means a single loop of execution which include all the phases listed above.

As per the name the term “ process.nextTick” means function will be executed in the next event loop of execution.

Abstract from the above article

Before each phase of the event loop (timers queue, IO events queue, immediates queue, close handlers queue are the four main phases), before moving to the phase, Node checks for the nextTick queue for any queued events. If the queue is not empty, Node will start processing the queue immediately until the queue is empty, before moving to the main event loop phase.

From the above statement I concluded that before moving to next phase (timers queue or IO events queue or immediates queue or close handlers) “next tick queue” will be processed.

As per the link it should be processed after the current loop is executed ie in next loop but the “tick queue” is processed when the next phase is executed.

Would appreciate if you could shed some light on this.

Regards