Rocketseat / adonis-bull

The easiest way to start using an asynchronous job queue with AdonisJS. Ready for Adonis v5 ⚡️
MIT License
310 stars 57 forks source link

Missing removeRepeatable() method? #66

Open LeCoupa opened 3 years ago

LeCoupa commented 3 years ago

Is there a way to remove a repeatable job with the removeRepeatable() method?

Screenshot 2021-01-30 at 17 45 31
HigoRibeiro commented 3 years ago

Hi @LeCoupa! A way to do this directly by Bull has not yet been implemented, but you can try it like this:

Bull
 .getByKey('EmailPatternStatsJob')
 .bull
 .removeRepeatable('EmailPatternStatsJob', repeatOpts)

You need to follow the bull's own instructions: removeRepeatable, removeRepeatableByKey.

Then we can add something for the provider itself. :rocket:

LeCoupa commented 3 years ago

Great thank you 👍

fingunt commented 3 years ago

Hello, would it be possible to remove a job that is repeating every day of the week? I'm trying this way but it doesn't work

Bull .getByKey('EmailPatternStatsJob') .bull .removeRepeatable('EmailPatternStatsJob', repeatOpts)

joshca1 commented 1 week ago

Hello, would it be possible to remove a job that is repeating every day of the week? I'm trying this way but it doesn't work

Bull .getByKey('EmailPatternStatsJob') .bull .removeRepeatable('EmailPatternStatsJob', repeatOpts)

you can do it like this, first list all repeated jobs, then get the key and remove them:

let repeteadJobs = await Bull.getByKey('TestCronJob').bull.getRepeatableJobs() / here get the key of repeteadJobs and then use on removeRepeatableByKey / Bull.getByKey('TestCronJob').bull.removeRepeatableByKey('TestCronJob::::/10 ')