Rocketseat / adonis-bull

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

Remove repeatable jobs #126

Closed GeekyGeeky closed 1 year ago

GeekyGeeky commented 1 year ago

There is no method to remove repeatable job in the alpha package. Please can it be added?

evoactivity commented 1 year ago

@GeekyGeeky you can remove repeatable jobs like this

import Bull from '@ioc:Rocketseat/Bull';
import RepeatJob from 'App/Jobs/RepeatJob';

const { key } = new RepeatJob();
const repeatOpts = {
  cron: '*/5 * * * *', // every 5 minutes
};

Bull.getByKey(key).bull.removeRepeatable(key, repeatOpts);
Bull.add(
  key,
  {},
  {
    repeat: repeatOpts,
  }
);
GeekyGeeky commented 1 year ago

Thank you @evoactivity

I would use your suggestion 👍