| title | Wait for |
|---|---|
| description | Wait for a period of time, then continue execution. |
import PausedExecutionFree from "/snippets/paused-execution-free.mdx"
Inside your tasks you can wait for a period of time before you want execution to continue.
export const veryLongTask = task({
id: "very-long-task",
run: async (payload) => {
await wait.for({ seconds: 5 });
await wait.for({ minutes: 10 });
await wait.for({ hours: 1 });
await wait.for({ days: 1 });
await wait.for({ weeks: 1 });
await wait.for({ months: 1 });
await wait.for({ years: 1 });
},
});This allows you to write linear code without having to worry about the complexity of scheduling or managing cron jobs.