Features
CRON
Schedule recurring executions
Overview
Defer allows you to schedule recurring executions. This is useful for example when you have a weekly newsletter to send to your users every Monday.
You can schedule a recurring execution using the defer.cron()
function rather
than defer
.
export default defer.cron(myFunc, "* * * * *");
With Defer CRON your schedule is defined in UTC.
Example
import { defer } from "@defer/client";
async function sendMondayNewletter() {
// business logic here
}
export default defer.cron(sendMondayNewletter, "0 0 * * MON");
If you are not an expert of the CRON syntax, no worries! You can use the crontab.guru website to build your CRON expression!
Related
Was this page helpful?