Skip to content

Commit ebd51b8

Browse files
Document new Nexus Operation timeouts
1 parent 12c4af9 commit ebd51b8

1 file changed

Lines changed: 51 additions & 2 deletions

File tree

docs/encyclopedia/nexus-operations.mdx

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ keywords:
1414
- nexus circuit breaking
1515
- nexus circuit breaker
1616
- circuit breaker is open
17+
- nexus timeouts
18+
- schedule-to-close timeout
19+
- schedule-to-start timeout
20+
- start-to-close timeout
1721
- execution semantics
1822
- temporal sdk
1923
- versioning
@@ -179,7 +183,7 @@ For example, when you execute a Nexus Operation in a caller Workflow the followi
179183
## Automatic retries {#automatic-retries}
180184

181185
Once the caller Workflow schedules an Operation with the caller's Temporal Service, the caller's Nexus Machinery keeps trying to start the Operation.
182-
If a [retryable Nexus error](/references/failures#nexus-errors) is returned the Nexus Machinery will retry until the Nexus Operation's Start-to-Close-Timeout is exceeded.
186+
If a [retryable Nexus error](/references/failures#nexus-errors) is returned the Nexus Machinery will retry until the Nexus Operation's [Schedule-to-Close timeout](#schedule-to-close-timeout) is exceeded.
183187

184188
For example, if a Nexus handler returns a [retryable error](/references/failures#nexus-errors), or an [upstream timeout](https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors) is encountered by the caller, the Nexus request will be retried up to the [default Retry Policy's](https://github.com/temporalio/temporal/blob/de7c8879e103be666a7b067cc1b247f0ac63c25c/components/nexusoperations/config.go#L111) max attempts and expiration interval.
185189

@@ -193,6 +197,51 @@ This differs from how Activities and Workflows handle errors and retries:
193197

194198
See [errors in Nexus handlers](/nexus/error-handling#errors-in-nexus-handlers) to control the retry behavior by returning a [non-retryable Nexus error](/references/failures#non-retryable-nexus-errors).
195199

200+
## Timeouts {#timeouts}
201+
202+
Nexus Operations support three types of timeouts that control how long the caller is willing to wait at different stages of the Operation lifecycle.
203+
These timeouts are set by the caller when scheduling the Operation.
204+
205+
### Schedule-to-Close timeout {#schedule-to-close-timeout}
206+
207+
The Schedule-to-Close timeout limits the total duration from when the Operation is scheduled to when it completes.
208+
This is the overall timeout for the entire Operation.
209+
The Nexus Machinery [automatically retries](#automatic-retries) failed requests internally until this timeout is exceeded, at which point the Operation fails with a [NexusOperationTimedOut](/references/events#nexusoperationtimedout) event.
210+
211+
For asynchronous Operations, this timeout covers the full lifecycle: scheduling, starting, and completing.
212+
For synchronous Operations, this timeout covers the time from scheduling to receiving the result.
213+
214+
In Temporal Cloud, the maximum Schedule-to-Close timeout is 60 days.
215+
216+
### Schedule-to-Start timeout {#schedule-to-start-timeout}
217+
218+
The Schedule-to-Start timeout limits how long the caller is willing to wait for the Operation to be started (or completed, if synchronous) by the handler.
219+
If the Operation is not started within this timeout, it fails with `TIMEOUT_TYPE_SCHEDULE_TO_START`.
220+
221+
If not set or set to zero, no Schedule-to-Start timeout is enforced.
222+
223+
:::note
224+
225+
The Schedule-to-Start timeout requires Temporal Server version 1.31.0 or later.
226+
227+
:::
228+
229+
### Start-to-Close timeout {#start-to-close-timeout}
230+
231+
The Start-to-Close timeout limits how long the caller is willing to wait for an asynchronous Operation to complete after it has been started.
232+
If the Operation does not complete within this timeout after starting, it fails with `TIMEOUT_TYPE_START_TO_CLOSE`.
233+
234+
This timeout only applies to asynchronous Operations.
235+
Synchronous Operations ignore this timeout because they complete as part of the start request.
236+
237+
If not set or set to zero, no Start-to-Close timeout is enforced.
238+
239+
:::note
240+
241+
The Start-to-Close timeout requires Temporal Server version 1.31.0 or later.
242+
243+
:::
244+
196245
## Circuit breaking {#circuit-breaking}
197246

198247
Circuit breaking handles deployment issues, such as remote service faults, that take time to recover.
@@ -296,7 +345,7 @@ Pending Nexus Operations: 1
296345

297346
### At-least-once execution semantics and idempotency
298347

299-
The Nexus Machinery provides reliable execution with at-least-once execution semantics for a Nexus Operation, until the caller's Schedule-to-Close-Timeout is exceeded, at which time the overall Nexus Operation times out.
348+
The Nexus Machinery provides reliable execution with at-least-once execution semantics for a Nexus Operation, until the caller's [Schedule-to-Close timeout](#schedule-to-close-timeout) is exceeded, at which time the overall Nexus Operation times out.
300349

301350
The Nexus Machinery breaks up the [Nexus Operation lifecycle](/nexus/operations#operation-lifecycle) into one or more [Nexus Tasks](/tasks#nexus-task) that a Nexus handler is responsible for processing.
302351
If a Nexus handler times out or returns a non-retryable Nexus error, then the Nexus Machinery will retry the Nexus request to provide at-least-once execution.

0 commit comments

Comments
 (0)