Workflow
Temporal Workflow 有三种不同的 timeout
Workflow Execution Chain Timeout
自 WorkflowExecutionStarted 开始到结束(含所有的重试和 Continue-As-New)
(双击查看时序参考图 → ← )
默认无限
(官方叫 Workflow Execution Timeout,但我觉得复用 Workflow Execution Chain 术语会更好理解)
Workflow Run Timeout
自一次 WorkflowExecutionStarted 开始到结束(如果出现 Retry / Continue-As-New 会重新计算)
(双击查看时序参考图 → ← )
默认无限
Workflow Task Timeout
自 WorkflowTaskStarted 到 WorkflowTaskCompleted 结束
默认 10s
注意:这不是 Workflow 的 timeout 而是「Workflow Task」的 timeout
映射的是 Workflow 里面自己的代码的最长等待时间,不含 Child Workflow / Activity 执行、等待执行结果等
This timeout is primarily available to recognize whether a Worker has gone down so that the Workflow Execution can be recovered on a different Worker.
The main reason for increasing the default value is to accommodate a Workflow Execution that has an extensive Workflow Execution History, requiring more than 10 seconds for the Worker to load.
It's worth mentioning that although you can extend the timeout up to the maximum value of 120 seconds, it's not recommended to move beyond the default value.
Activity
Temporal Activity 有三种不同的 timeout
Schedule-To-Start Timeout
单次从 ActivityTaskScheduled 到 ActivityTaskStarted 的间隔时间(不包含 Retry 间隔)
(双击查看时序参考图 → ← )
默认无限重试
Start-To-Close Timeout
单次从 ActivityTaskStarted 到结束(ActivityTaskFailed / ActivityTaskCompleted)的间隔时间(不包含 Retry)
(双击查看时序参考图 → ← )
默认与 Schedule-To-Close Timeout 相同
Schedule-To-Close Timeout
从第一次 ActivityTaskScheduled 到最终结束的间隔时间(包括中间所有的 Retry)
(双击查看时序参考图 → ← )
默认无限
重点关注
Schedule-To-Close 可以理解为这个 activity 整体的最长时间
Start-To-Close 可以理解为这个 activity 单次最长的执行时间,用于处理异常情况(无限等待 / 进程崩溃 / Worker 宕机等)
The Temporal Server doesn't detect failures when a Worker loses communication with the Server or crashes. Therefore, the Temporal Server relies on the Start-To-Close Timeout to force Activity retries.
Temporal 强制要求「Start-To-Close」和「Schedule-To-Close」必须设定一个默认值,因此 Start-To-Close Timeout 其实不可能为 ∞