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

Can't clean queue #223

Closed
jaschaio opened this issue Jun 8, 2020 · 3 comments
Closed

Can't clean queue #223

jaschaio opened this issue Jun 8, 2020 · 3 comments

Comments

@jaschaio
Copy link

jaschaio commented Jun 8, 2020

Not sure what I am doing wrong, it was working on Bull:v3.

// Lets take as a given that I have added 800 jobs without defining a Worker before so all jobs should be "waiting"
const jobs = await queue.getJobCounts( 'waiting' );
console.log( `There are ${ jobs.waiting } jobs to clean` );
    
const wait = await queue.clean( 0, 0, 'wait' );
console.log( `cleaned ${ wait.length } wait jobs` );

This outputs:

There are 800 jobs to clean
cleaned 0 wait jobs

I thought that maybe the second parameter limit shouldn't be 0, but I tried with a high number instead and still no jobs are being removed. Using waiting instead of wait leads to the same result.

What am I doing wrong?

@jaschaio
Copy link
Author

jaschaio commented Jun 8, 2020

queue.drain() works as expected removing all waiting jobs. So am I supposed to use that method instead of queue.clean( 0, 0, 'wait' )?

@roggervalf
Copy link
Collaborator

hi @jaschaio, this case is a little weird since there is a test case that covers what you are mentioning https://github.com/taskforcesh/bullmq/blob/master/src/test/test_clean.ts#L97-L105

@jaschaio
Copy link
Author

I have moved on so can't really give more input on this. Thanks anyway

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