Skip to content

Commit 16544c4

Browse files
uNetworkingABronag
authored andcommitted
src: skip costly pushing/popping if we pass zeroes as async context
1 parent 752d75d commit 16544c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/api/callback.cc

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
5656
CHECK_NOT_NULL(env);
5757
env->PushAsyncCallbackScope();
5858

59+
// Skip costly pushing/popping if we pass zeroes as async context
60+
if (async_context_.async_id == 0) {
61+
pushed_ids_ = false;
62+
return;
63+
}
64+
5965
if (!env->can_call_into_js()) {
6066
failed_ = true;
6167
return;

0 commit comments

Comments
 (0)