Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving promises within workers #212

Open
sacOO7 opened this issue Nov 7, 2020 · 1 comment
Open

Resolving promises within workers #212

sacOO7 opened this issue Nov 7, 2020 · 1 comment

Comments

@sacOO7
Copy link

sacOO7 commented Nov 7, 2020

@bruceon
Copy link

bruceon commented Mar 13, 2021

I am not sure whether I fully understand your question or not. Basically, the logic provided as a parameter of map is your code. That part will be executed in the separate process or thread. Once your logic finishes execution, the result returned will be wrapped into a message and delivered to the parent process/thread. The parent process/thread is waiting for some resolved result from the child, not a promise or a group of promises. So, you'd better write some code to wait for all promises getting resolved in the child side, and then return the final resolved result to the parent. It looks like that's how parallel.js works.

There is a new launched peoject "jsworkers" (inheriting code and all features from parallel.js, and supporting more handy additions). But you are supposed to have the same issue if you want to give it a try. https://github.com/brucecan/jsworkers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants