Skip to content

Commit

Permalink
EDU-3304 - Document next retry delay in .NET (#3085)
Browse files Browse the repository at this point in the history
* Document next retry delay in .NET

* Update docs/develop/dotnet/failure-detection.mdx

* Update docs/develop/dotnet/failure-detection.mdx

* Update docs/develop/dotnet/failure-detection.mdx

* Update docs/develop/dotnet/failure-detection.mdx

* Update docs/develop/dotnet/failure-detection.mdx

---------

Co-authored-by: Erica Sadun <[email protected]>
  • Loading branch information
cretz and fairlydurable authored Oct 8, 2024
1 parent d9f3427 commit eb800b0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/develop/dotnet/failure-detection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,23 @@ return await Workflow.ExecuteActivityAsync(
});
```

### Override the Retry interval with `nextRetryDelay` {#next-retry-delay}

When you throw an [Application Failure](/references/failures#application-failure) and assign the `nextRetryDelay` field, its value replaces and overrides the Retry interval defined in the active Retry Policy.

For example, you might scale the next Retry delay interval based on the current number of attempts.
Here's how you'd do that in an Activity.
In the following sample, the `attempt` count is retrieved from the Activity Execution context and used to set the number of seconds for the next Retry delay:

```csharp
var attempt = ActivityExecutionContext.Current.Info.Attempt;

throw new ApplicationFailureException(
$"Something bad happened on attempt {attempt}",
errorType: "my_failure_type",
nextRetryDelay: TimeSpan.FromSeconds(3 * attempt));
```

## Heartbeat an Activity {#activity-heartbeats}

**How to Heartbeat an Activity using the Temporal .NET SDK**
Expand Down

0 comments on commit eb800b0

Please sign in to comment.