Skip to main content

Static CRON attached to tasks

You can now attach schedules directly to your scheduled tasks. They sync when you run the dev or deploy commands.

More info here: https://trigger.dev/changelog/declarative-cron

And in the docs: https://trigger.dev/docs/v3/tasks-scheduled

import { logger, schedules } from "@trigger.dev/sdk/v3";

export const checkMetrics = schedules.task({
  id: "check-metrics",
  //6am every day
  cron: "0 6 * * *",
  run: async (payload) => {
    const formattedTime = payload.timestamp.toLocaleString("en-US");
    logger.log(formattedTime);
  },
});
Status: Completed

No comments yet

Be the first to share your thoughts.