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 is blocked after queue.kill() #1422

Closed
CharlieHess opened this issue May 23, 2017 · 4 comments
Closed

Queue is blocked after queue.kill() #1422

CharlieHess opened this issue May 23, 2017 · 4 comments

Comments

@CharlieHess
Copy link

What version of async are you using?
This behavior occurs on all versions of async, but I'm using the latest.

Which environment did the issue occur in (Node version/browser version)
Node v7.x.y

What did you do? Please include a minimal reproducable case illustrating issue.
I'm using a queue with concurrency of 1. I'm adding tasks to it that can take a long time. Sometimes I want to empty the queue, kill its current running operation, and "retry now" by enqueuing a new operation.

Reading the documentation, queue.kill() seemed ideal for this.

What did you expect to happen?
I expected queue.kill() to put the queue into a kind of empty, clean state. Adding a new operation after calling kill should execute it immediately.

What was the actual result?
The current running operation is left orphaned, and any newly queued operations are stuck waiting for it, forever.

@aearly aearly added the queue label May 23, 2017
@aearly
Copy link
Collaborator

aearly commented May 23, 2017

Our current model is that after q.kill() you would no longer use that queue, and you would create a new queue if you wanted to continue processing. We'd have to do a lot more internal cleanup if the queue were able to be "resurrected".

@CharlieHess
Copy link
Author

OK, coincidentally that's what I ended up doing myself but we might wanna add a note to the documentation so other folks don't stumble. 👍

@hargasinski
Copy link
Collaborator

Added a note to the q.kill docs. Thanks @CharlieHess!

@ORESoftware
Copy link
Contributor

ORESoftware commented Jun 24, 2018

So the docs now say:

kill | function | a function that removes the drain callback and empties remaining tasks from the queue forcing it to go idle. No more tasks should be pushed to the queue after calling this function. Invoke with queue.kill().

my question is - if we keep adding a few tasks to the queue, I am pretty sure nothing will break.

What the docs should say - if you want to process new tasks, you need to use a new queue instance.

Isn't that right?

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

No branches or pull requests

4 participants