I had a clarification for queue.clean. I am reading the docs here:
https://github.com/OptimalBits/bull/blob/HEAD/REFERENCE.md#queueclean
And I intend to use it the following way, high level:
I have hundreds of recurring jobs that have unique ids provided by uuid. If one of them gets stuck active, it wont process data. But it's okay if I remove it, because I just need it to run the next time and not get stuck.
So I added a job to clear active jobs that have been stuck longer than 5 minutes viz:
queue.clean( 5 * 60 * 1000, 'active' );
Am I understanding that correctly? It will only remove stuck active jobs, or jobs that are currently active and have been active for over 5 minutes?
Thanks.
yeah, I think you got it right, however the clean is based on the timestamp when the job was created, not on the timestamp on when it started to be processed (this method is a bit old and does not take advantage of the new timestamps we have now). However, in your case I think it is better to specify a TTL for the jobs, so that they will fail automatically if they spent more time than they should, then you can remove them using the removeOnFailed option or using clean.
Most helpful comment
yeah, I think you got it right, however the clean is based on the timestamp when the job was created, not on the timestamp on when it started to be processed (this method is a bit old and does not take advantage of the new timestamps we have now). However, in your case I think it is better to specify a TTL for the jobs, so that they will fail automatically if they spent more time than they should, then you can remove them using the
removeOnFailedoption or using clean.