mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
When native code invokes a registered callback from the event loop, no callback scope is active. A nextTick or microtask queued by the callback only ran when an unrelated Node.js callback fired, or at beforeExit. Open an InternalCallbackScope in InvokeCallback when no scope is active, so the queues are drained when the callback returns. Callbacks invoked synchronously during a call into native code already run inside the caller's scope and are left unchanged. Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Assisted-by: claude:opus-5.5 PR-URL: https://github.com/nodejs/node/pull/66918 Fixes: https://github.com/nodejs/node/issues/66917 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>