CAKE20

AI Web PaaS

schedule tasks

Run cron functions in website web processes without duplication.

Create a task

// server/tasks/check.task.ts
export const config = {
  active: false,
  cron: "*/30 * * * * *" // seconds, with an actual execution interval of at least 5 seconds.
};

export default async () => {
  console.log("check task started");
};

cron has 6 digits including seconds. An error occurs even if you enter an interval of less than 5 seconds. Runtime limits the actual execution interval to at least 5 seconds. Uses the package.json timezone, or if not set, the system timezone. If the previous execution has not finished, the same task will not be executed overlappingly. in operation A website that is deployed and started must have active: true and then run 5 seconds before the Manager Automatically wakes up by sending an internal HTTP ping.

manual testing

If you open the task file in the editor and click Run Test, even if active: false Runs once without waiting for cron. Also test console.log output You can check it in the console.