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);
  },
});

Upvoters
Status

Completed

Board

πŸ’‘ Feature Request

Date

Over 1 year ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.