Skip to content

Commit ccf951d

Browse files
Respond to PR comments
1 parent ebd51b8 commit ccf951d

2 files changed

Lines changed: 42 additions & 4 deletions

File tree

docs/develop/go/temporal-nexus.mdx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,45 @@ func HelloCallerWorkflow(ctx workflow.Context, name string, language service.Lan
336336
```
337337
<!--SNIPEND-->
338338

339+
### Set Nexus Operation timeouts
340+
341+
Nexus Operations support [three types of timeouts](/encyclopedia/nexus-operations#timeouts) that control how long the caller is willing to wait at different stages of the Operation lifecycle.
342+
Set these timeouts in `NexusOperationOptions` when calling `ExecuteOperation`.
343+
344+
#### Schedule-to-Close timeout
345+
346+
The [Schedule-to-Close timeout](/encyclopedia/nexus-operations#schedule-to-close-timeout) limits the total duration of the Operation from when it is scheduled to when it completes.
347+
The Nexus Machinery automatically retries failed requests until this timeout is exceeded.
348+
349+
```go
350+
fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
351+
ScheduleToCloseTimeout: 10 * time.Minute,
352+
})
353+
```
354+
355+
#### Schedule-to-Start timeout
356+
357+
The [Schedule-to-Start timeout](/encyclopedia/nexus-operations#schedule-to-start-timeout) limits how long the caller will wait for the Operation to be started by the handler.
358+
If not set, no Schedule-to-Start timeout is enforced.
359+
360+
```go
361+
fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
362+
ScheduleToStartTimeout: 2 * time.Minute,
363+
})
364+
```
365+
366+
#### Start-to-Close timeout
367+
368+
The [Start-to-Close timeout](/encyclopedia/nexus-operations#start-to-close-timeout) limits how long the caller will wait for an asynchronous Operation to complete after it has been started.
369+
This timeout only applies to asynchronous Operations.
370+
If not set, no Start-to-Close timeout is enforced.
371+
372+
```go
373+
fut := c.ExecuteOperation(ctx, service.HelloOperationName, service.HelloInput{Name: name, Language: language}, workflow.NexusOperationOptions{
374+
StartToCloseTimeout: 5 * time.Minute,
375+
})
376+
```
377+
339378
### Register the caller Workflow in a Worker
340379

341380
After developing the caller Workflow, the next step is to register it with a Worker.

docs/encyclopedia/nexus-operations.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ For example, when you execute a Nexus Operation in a caller Workflow the followi
183183
## Automatic retries {#automatic-retries}
184184

185185
Once the caller Workflow schedules an Operation with the caller's Temporal Service, the caller's Nexus Machinery keeps trying to start the Operation.
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.
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) or [Schedule-to-close timeout](#schedule-to-close-timeout) is exceeded.
187187

188188
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.
189189

@@ -208,10 +208,9 @@ The Schedule-to-Close timeout limits the total duration from when the Operation
208208
This is the overall timeout for the entire Operation.
209209
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.
210210

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.
211+
This timeout covers the full [Nexus Operation lifecycle](https://docs.temporal.io/nexus/operations#operation-lifecycle). Asynchronous Operations are scheduled, started, and completed. Synchronous Operations don't have an intermediate started state because they complete as part of the start request.
213212

214-
In Temporal Cloud, the maximum Schedule-to-Close timeout is 60 days.
213+
In Temporal Cloud, the [maximum Schedule-to-Close timeout is 60 days](https://docs.temporal.io/cloud/limits#nexus-operation-duration-limits).
215214

216215
### Schedule-to-Start timeout {#schedule-to-start-timeout}
217216

0 commit comments

Comments
 (0)