Skip to content

Commit

Permalink
Fix descriptions for pipelines based on feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-csala committed Oct 20, 2023
1 parent 2d3902d commit 7ff0f4b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
26 changes: 16 additions & 10 deletions docs/pipelines/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ Use `ExecuteOutcomeAsync(...)` in high-performance scenarios where you wish to a

### Sequence diagram for a pipeline with retry and timeout

Let's create the following pipeline:

- the inner strategy is a timeout,
- the outer is a retry which is timeout-aware.

<!-- snippet: resilience-pipeline-diagram-retry-timeout -->
```cs
// Let's create the following pipeline:
// the inner strategy is a timeout,
// the outer is a retry which is timeout-aware.
ResiliencePipeline pipeline = new ResiliencePipelineBuilder()
.AddRetry(new() { ShouldHandle = new PredicateBuilder().Handle<TimeoutRejectedException>() }) // outer
.AddTimeout(TimeSpan.FromSeconds(1)) // inner
Expand Down Expand Up @@ -198,11 +200,13 @@ sequenceDiagram

### Sequence diagram for a pipeline with timeout and retry

Let's create the following pipeline:

- the inner strategy is a retry,
- the outer is a timeout which overarches all retry attempts.

<!-- snippet: resilience-pipeline-diagram-timeout-retry -->
```cs
// Let's create the following pipeline:
// the inner strategy is a retry,
// the outer is a timeout which overarches all retry attempts.
ResiliencePipeline pipeline = new ResiliencePipelineBuilder()
.AddTimeout(TimeSpan.FromSeconds(10)) // outer
.AddRetry(new()) // inner
Expand Down Expand Up @@ -261,12 +265,14 @@ sequenceDiagram

### Sequence diagram for a pipeline with timeout, retry and timeout

Let's create the following pipeline:

- the inner most strategy is a timeout (per attempt),
- the middle one is a retry which is timeout-aware,
- the outer most is a timeout which overarches all retry attempts.

<!-- snippet: resilience-pipeline-diagram-timeout-retry-timeout -->
```cs
// Let's create the following pipeline:
// the inner most strategy is a timeout (per attempt),
// the middle one is a retry which is timeout-aware,
// the outer most is a timeout which overarches all retry attempts.
ResiliencePipeline pipeline = new ResiliencePipelineBuilder()
.AddTimeout(TimeSpan.FromSeconds(10)) // outer most
.AddRetry(new() { ShouldHandle = new PredicateBuilder().Handle<TimeoutRejectedException>() })
Expand Down
16 changes: 6 additions & 10 deletions src/Snippets/Docs/ResiliencePipelines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,41 +86,37 @@ public static void ConfigureMyPipelines(IServiceCollection services)
public static void ResiliencePipelinesDiagramRetryTimeout()
{
#region resilience-pipeline-diagram-retry-timeout
// Let's create the following pipeline:
// the inner strategy is a timeout,
// the outer is a retry which is timeout-aware.

ResiliencePipeline pipeline = new ResiliencePipelineBuilder()
.AddRetry(new() { ShouldHandle = new PredicateBuilder().Handle<TimeoutRejectedException>() }) // outer
.AddTimeout(TimeSpan.FromSeconds(1)) // inner
.Build();

#endregion
}

public static void ResiliencePipelinesDiagramTimeoutRetry()
{
#region resilience-pipeline-diagram-timeout-retry
// Let's create the following pipeline:
// the inner strategy is a retry,
// the outer is a timeout which overarches all retry attempts.

ResiliencePipeline pipeline = new ResiliencePipelineBuilder()
.AddTimeout(TimeSpan.FromSeconds(10)) // outer
.AddRetry(new()) // inner
.Build();

#endregion
}

public static void ResiliencePipelinesDiagramTimeoutRetryTimeout()
{
#region resilience-pipeline-diagram-timeout-retry-timeout
// Let's create the following pipeline:
// the inner most strategy is a timeout (per attempt),
// the middle one is a retry which is timeout-aware,
// the outer most is a timeout which overarches all retry attempts.

ResiliencePipeline pipeline = new ResiliencePipelineBuilder()
.AddTimeout(TimeSpan.FromSeconds(10)) // outer most
.AddRetry(new() { ShouldHandle = new PredicateBuilder().Handle<TimeoutRejectedException>() })
.AddTimeout(TimeSpan.FromSeconds(1)) // inner most
.Build();

#endregion
}

Expand Down

0 comments on commit 7ff0f4b

Please sign in to comment.