Skip to main content

Timeouts and Retry Policies

View Markdown

In Temporal, timeouts detect application failures. The system can then automatically mitigate these failures through retries. Both major application function primitives, Workflows and Activities, have dedicated timeout configurations and can be configured with a Retry Policy.

Follow one of our tutorials to Get started exploring timeouts and Retry Policies.

Workflow timeouts

Each Workflow timeout limits a different aspect of a Workflow Execution, and you set them when you start the Workflow Execution.

Workflows are built to run for long periods and to survive failures, so most applications don't need a Workflow Execution Timeout or Workflow Run Timeout. A timeout limits how long a Workflow can absorb delays. To act after a set period inside a Workflow, use a Timer instead. Workflow Execution and Workflow Run Timeouts are most often used to bound a Temporal Cron Job.

Set Workflow timeouts and Retry Policies in your language:

Activity timeouts

Activity timeouts tell a Workflow which kind of Activity failure occurred, and the Activity's Retry Policy decides what happens next.

Every Activity Execution needs either a Start-To-Close or a Schedule-To-Close Timeout. Set Start-To-Close: the Temporal Service can't tell when a Worker crashes or loses contact, so it relies on this timeout to retry the Activity. Long-running Activities should also Heartbeat and set a Heartbeat Timeout, which detects a lost Worker sooner than a long Start-To-Close Timeout can.

Set Activity timeouts and Retry Policies in your language:

Resources

For a deep dive into timeouts and Retry Policies visit the following Temporal Encyclopedia pages or enroll in one of our courses.