Run microtasks each iteration
This commit is contained in:
parent
493585e954
commit
80f10df8de
|
@ -54,6 +54,10 @@ void print(const FunctionCallbackInfo<Value> &args) {
|
||||||
* Should return int queueSize after calling queued items, so that
|
* Should return int queueSize after calling queued items, so that
|
||||||
* proper while(processNextTickQueueImpl()) can be done */
|
* proper while(processNextTickQueueImpl()) can be done */
|
||||||
int processNextTickQueueImpl(Isolate *isolate) {
|
int processNextTickQueueImpl(Isolate *isolate) {
|
||||||
|
|
||||||
|
/* Run async continuations, promises and other V8-queued tasks */
|
||||||
|
isolate->RunMicrotasks();
|
||||||
|
|
||||||
if (nextTickQueue.size()) {
|
if (nextTickQueue.size()) {
|
||||||
/* Swap queues for recursive calls */
|
/* Swap queues for recursive calls */
|
||||||
std::vector<UniquePersistent<Function>> currentNextTickQueue = std::move(nextTickQueue);
|
std::vector<UniquePersistent<Function>> currentNextTickQueue = std::move(nextTickQueue);
|
||||||
|
|
Loading…
Reference in New Issue