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

Make workers pull from your own queue #440

Open
CMCDragonkai opened this issue Jul 31, 2022 · 0 comments
Open

Make workers pull from your own queue #440

CMCDragonkai opened this issue Jul 31, 2022 · 0 comments

Comments

@CMCDragonkai
Copy link

I know threadsjs has a queue method available on it's Pool class, but I want to create my own queue, in particular I'm writing a persistent queue.

I would like the worker threads to pull from the queue when they are ready/idle for the next task. And this pulling mechanism needs to be blocking to avoid busy-looping on the workers. That is they should just be awaiting on a promise that only resolves when a task is available for dispatch.

What is the right way to do this? Should I be extending the Pool class, or can I make the workers directly pull from some sort of shared queue data structure system?

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

1 participant