Waiting allows you to write complex tasks as a set of async code, without having to scheduled another task or poll for changes.

In the Trigger.dev Cloud we automatically pause execution of tasks when they are waiting for longer than a few seconds. You are not charged when execution is paused.

FunctionWhat it does
wait.for()Waits for a specific period of time, e.g. 1 day.
wait.until()Waits until the provided Date.
wait.forRequest()Waits until a matching HTTP request is received, and gives you the data to continue with.
waitForEvent()Waits for a matching event, like in the example above.