diff --git a/src/node_process.cc b/src/node_process.cc index 74b2b64f3458e1..6e9c06e02d81b8 100644 --- a/src/node_process.cc +++ b/src/node_process.cc @@ -797,29 +797,17 @@ void GetActiveRequests(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); Local ary = Array::New(args.GetIsolate()); - Local ctx = env->context(); - Local fn = env->push_values_to_array_function(); - Local argv[NODE_PUSH_VAL_TO_ARRAY_MAX]; - size_t idx = 0; - + std::vector> request_v; for (auto w : *env->req_wrap_queue()) { if (w->persistent().IsEmpty()) continue; - argv[idx] = w->GetOwner(); - if (++idx >= arraysize(argv)) { - fn->Call(ctx, ary, idx, argv).ToLocalChecked(); - idx = 0; - } - } - - if (idx > 0) { - fn->Call(ctx, ary, idx, argv).ToLocalChecked(); + request_v.push_back(w->GetOwner()); } - args.GetReturnValue().Set(ary); + args.GetReturnValue().Set( + Array::New(env->isolate(), request_v.data(), request_v.size())); } - // Non-static, friend of HandleWrap. Could have been a HandleWrap method but // implemented here for consistency with GetActiveRequests(). void GetActiveHandles(const FunctionCallbackInfo& args) {