Comment on page
Retrying failed tasks is a powerful feature that allows you to improve the reliability of your application. In some cases, though, retrying a failed task isn't enough. In those cases, the
attemptsoption won't suffice. That's where the
repeatoption comes in.
repeatoption allows you to schedule a task to run at regular intervals. You can specify the pattern in cron syntax, and the limit indicates the number of times the task should run.
Here's an example payload:
import axios from 'axios';
"pattern": "*/10 * * * * *",
In this example, the payload schedules a task to be run every 10 seconds for a total of 5 times.
This feature is particularly useful for recurring tasks, such as sending a daily summary email or processing a queue at regular intervals.
Note that, just like with the
repeatoption does not guarantee that the task will be successful. Therefore, you should always handle the case where the task fails.