deno.com

Deno Cron

在 Github 上编辑

Warning: This is an unstable API that is subject to change or removal at anytime.
Deno Cron is a cron task scheduler built into the Deno runtime and works with zero configuration on Deno Deploy. There's no overlapping cron executions and has automatic handler retries on exceptions.

Create a cron job called "Log a message" that runs once a minute.
Deno.cron("Log a message", "* * * * *", () => {
  console.log("This will print once a minute.");
});
Create a cron job with a backoff schedule measured in milliseconds.
Deno.cron("Retry example", "* * * * *", {
  backoffSchedule: [1000, 5000, 10000],
}, () => {
  throw new Error("Deno.cron will retry this three times, to no avail!");
});

使用 Deno CLI 在本地运行 此示例

deno run --unstable-cron https://docs.denohub.com/examples/scripts/cron.ts

你找到需要的内容了吗?

隐私政策