Previously, promise chain might not be invoked at all in some cases.
Specifically, this happened in HTTP module if promise chain did not start
with a r.subrequest() invocation.
The fix is to always process all pending promise events after the main module
function.
This closes #359 issue on GitHub.
return NGX_ERROR;
}
- if (njs_vm_pending(vm)) {
- return NGX_AGAIN;
- }
-
- return NGX_OK;
+ return njs_vm_run(vm);
}
} while (!njs_queue_is_empty(promise_events));
- return njs_posted_events(vm) ? NJS_AGAIN : NJS_OK;
+ return njs_vm_pending(vm) ? NJS_AGAIN : NJS_OK;
}