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

Queue tasks or abort current task and start new task #115

Open
jordijansen opened this issue Aug 31, 2021 · 2 comments
Open

Queue tasks or abort current task and start new task #115

jordijansen opened this issue Aug 31, 2021 · 2 comments
Labels
question Further information is requested

Comments

@jordijansen
Copy link

So I'm just getting my head around a problem I'm having with the useWorker hook. I currently call the worker in a useEffect hook but when the useEffect hook is triggered multiple times while the worker hasn't finished yet I'm getting the following error in the log:

[useWorker] You can only run one instance of the worker at a time, if you want to run more than one in parallel, create another instance with the hook useWorker(). Read more: https://github.com/alewin/useWorker 

The problem is I'm no longer interested in the result if the useEffect hook is triggered again so the worker should just abort the current task and start processing the new task. Or if that's not possible I want to queue a task for the worker to process next. Really curious if this can be achieved with the current hook or if I'm overlooking something.

@jordijansen jordijansen added the question Further information is requested label Aug 31, 2021
@onursagir
Copy link

There is a kill method in the controller api, but for me it doesn't kill when the status is PENDING so results may vary

@ashish-r
Copy link
Contributor

There is an issue with the kill functionality of the library, I have created a fix for the same. Waiting for the maintainers to review and merge the same.
#122

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

No branches or pull requests

3 participants