Skip to main content
Inside your tasks you can wait for a period of time before you want execution to continue.
/trigger/long-task.ts
This allows you to write linear code without having to worry about the complexity of scheduling or managing cron jobs. In the Trigger.dev Cloud we automatically pause execution of tasks when they are waiting for longer than a few seconds. When triggering and waiting for subtasks, the parent is checkpointed and while waiting does not count towards compute usage. When waiting for a time period (wait.for or wait.until), a wait longer than 5 seconds does not count towards compute usage. Free compute isn’t the same as freed concurrency: the concurrency slot is only released once we’ve snapshotted the machine and shut it down. For wait.for and wait.until that happens 60 seconds into the wait, so anything shorter stays EXECUTING and holds its slot for the whole wait.

Wait idempotency

You can pass an idempotency key to any wait function, allowing you to skip waits if the same idempotency key is used again. This can be useful if you want to skip waits when retrying a task, for example: