Relative Content

Tag Archive for javascriptnode.jsasynchronouspromisepromise.all

Promise.All() executing but resolving Promises immediately without waiting for responses

I am trying to execute some tasks in parallel (literally, spread over multiple threads and CPU cores) via firing them off using Promise.All(), which then calls a function that sets them off to work within a threadpool of threads in NodeJS. Before I do, I’m creating a list of Promises through calling NewQueuedTask(), which I store in QueuedTasks[] for use in Promise.All(). Each Promise points to a Launcher function that starts execution in the next available (idle) thread.