Revert MicrotasksPolicy::kAuto

This commit is contained in:
Alex Hultman 2019-03-12 12:16:54 +01:00
parent 74e8476ad4
commit 927cbd1681

View File

@ -61,11 +61,21 @@ void Main(Local<Object> exports) {
isolate = exports->GetIsolate(); isolate = exports->GetIsolate();
/* We want this so that we can redefine process.nextTick to using the V8 native microtask queue */ /* We want this so that we can redefine process.nextTick to using the V8 native microtask queue */
isolate->SetMicrotasksPolicy(MicrotasksPolicy::kAuto); // todo: setting this might be crashing nodejs?
// isolate->SetMicrotasksPolicy(MicrotasksPolicy::kAuto);
/* Integrate with existing libuv loop, we just pass a boolean basically */ /* Integrate with existing libuv loop, we just pass a boolean basically */
uWS::Loop::get((void *) 1); uWS::Loop::get((void *) 1);
// instead, for now we call this manually like before:
uWS::Loop::get()->setPostHandler([](uWS::Loop *) {
isolate->RunMicrotasks();
});
uWS::Loop::get()->setPreHandler([](uWS::Loop *) {
isolate->RunMicrotasks();
});
/* uWS namespace */ /* uWS namespace */
exports->Set(String::NewFromUtf8(isolate, "App"), FunctionTemplate::New(isolate, uWS_App<uWS::App>)->GetFunction()); exports->Set(String::NewFromUtf8(isolate, "App"), FunctionTemplate::New(isolate, uWS_App<uWS::App>)->GetFunction());
exports->Set(String::NewFromUtf8(isolate, "SSLApp"), FunctionTemplate::New(isolate, uWS_App<uWS::SSLApp>)->GetFunction()); exports->Set(String::NewFromUtf8(isolate, "SSLApp"), FunctionTemplate::New(isolate, uWS_App<uWS::SSLApp>)->GetFunction());