Removing repeatable jobs by data passed in queue.add
If I understand correctly, repeatable jobs are created via queue.add()
by passing the repeat
option as described e.g. here.
When calling getRepeatableJobs, however, all of the data that was passed to queue.add()
is not returned. Instead, I only get the key, name, id, etc.
In my use case, I am creating a repeatable job while passing a type
field in the job's data. If I then want to cancel all of the repeatable jobs of that type, how would I go about doing that? The only way I could so far come up with is to get all of the delayed jobs, filter the ones with the right type, and then retrieve all the repeatable jobs and "somehow" correlate their keys/ids with the delayed jobs.
Is there a better way to achieve this? If not, what's the safest way to correlate a delayed job with its repeatable job?
Bull version
1.14.8