From 80f10df8dea4a182703e976c09cde9ed36ad4859 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Fri, 8 Feb 2019 21:20:57 +0100 Subject: [PATCH] Run microtasks each iteration --- src/addon.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/addon.cpp b/src/addon.cpp index 9017bc1..8755096 100644 --- a/src/addon.cpp +++ b/src/addon.cpp @@ -54,6 +54,10 @@ void print(const FunctionCallbackInfo &args) { * Should return int queueSize after calling queued items, so that * proper while(processNextTickQueueImpl()) can be done */ int processNextTickQueueImpl(Isolate *isolate) { + + /* Run async continuations, promises and other V8-queued tasks */ + isolate->RunMicrotasks(); + if (nextTickQueue.size()) { /* Swap queues for recursive calls */ std::vector> currentNextTickQueue = std::move(nextTickQueue);