#[cron]Expand description
Marks a function as a scheduled cron task.
Cron jobs run on a schedule, exactly once per scheduled time across the cluster.
§Attributes
All attributes are specified inline within the macro:
- First argument: Cron schedule expression (required)
timezone = "UTC"- Timezone for the scheduletimeout = "1h"- Execution timeoutcatch_up- Run missed executions after downtimecatch_up_limit = 10- Maximum number of catch-up runs
§Example
ⓘ
#[forge::cron("0 0 * * *", timezone = "America/New_York", timeout = "30m", catch_up)]
pub async fn daily_cleanup(ctx: &CronContext) -> Result<()> {
// ...
}