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

[Question] Proper way to clear entire queue? #1814

Open
yaboi opened this issue Jul 30, 2020 · 0 comments
Open

[Question] Proper way to clear entire queue? #1814

yaboi opened this issue Jul 30, 2020 · 0 comments

Comments

@yaboi
Copy link

yaboi commented Jul 30, 2020

Description

Just curious if this is the most efficient way to clear an entire single queue of all jobs regardless of state.

It doesn't seem like .empty() or removeJobs('*') gets all jobs through my testing, but when using both it seems to consistently clear a queue. Is there a better, more sure-fire way to doing this?

Note, looping over each state and calling clean(0, state) didn't seem to clear all jobs either.

Minimal, Working Test code to reproduce the issue.

// No need to `.then()` an `await`
// await queue.pause(true).then(async () => {
//   await queue.empty()
//   await queue.removeJobs('*')
//   await queue.resume(true)
// })

await userQueue.pause(true)
await userQueue.empty()
await userQueue.removeJobs('*')
return await userQueue.resume(true)

Bull version

v3.16.0

Additional information

None

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

2 participants