I'm using Node v12.
I have a child process created with fork.
That child process executes an asynchronous task as follows:
// This is a child process
console.log('before async');
(async () => {
try {
console.log('before await')
await asyncTask();
console.log('after await')
} catch (e) {
console.log('ERROR!!')
} finally {
console.log('FINALLY!!')
}
})();
console.log('after async');
return true;
The output I am getting is
before async
before await
after async
No error.
What am I doing wrong?
------------------------ (Edited)
To add mode details of what I need to do:
- I need to consume a list of objects
- for each object I need to call AWS services (using SDK)
- I need to run them in parallel
- I need to wait for all of them in order to move for the next tasks
I'm currently using Parallel.js which uses fork.
I am open to use other libraries or tools.