bull
bull copied to clipboard
Enhancement: Recurrence Rule (rfc 5545, "rrule") support for repeating jobs
Enhancement Request
Support rrule (rfc5545) syntax as well as cron syntax for repeating jobs
paymentsQueue.add(paymentsData, {repeat: {rrule: 'DTSTART:20210401T23:59:59Z\nFREQ=DAILY;COUNT=2'}});
Recurrence rules are much more flexible than cron specifications, supporting things like "every monday and wednesday", or "the last thursday of the month, for five months". There's a js library to parse/validate rrules, which can generate the next Date the job should be run via
const rrule = rrulestr('DTSTART:20120201T023000Z\nRRULE:FREQ=MONTHLY;COUNT=5')
const nextRun = rrule.after(new Date);
This should be reasonably straightforward to add to getNextMillis, but rrule has some "quirks" if the system is not set to run in the UTC timezone.
I am using this temporarily