mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
AsyncResource saves the async context frame when it is created, and MakeCallback() enters it with async_context_frame::Scope. Then node::MakeCallback() opens the callback scope with an undefined frame, so the callback never runs in the saved one. Since AsyncContextFrame is the default, AsyncLocalStorage loses its store in these callbacks. Pass the saved frame to InternalMakeCallback(), as the Node-API AsyncContext already does. This also removes the Scope from every call, with its two Environment lookups and its global handle. Refs: https://github.com/nodejs/node/pull/66316 Refs: https://github.com/nodejs/node/issues/43038 Refs: https://github.com/nodejs/performance/issues/24 Signed-off-by: Nigro Simone <nigro.simone@gmail.com> PR-URL: https://github.com/nodejs/node/pull/66326 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>