Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/strategies/fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ var fallback = new ResiliencePipelineBuilder<HttpResponseMessage>()
{
ShouldHandle = new PredicateBuilder<HttpResponseMessage>()
.HandleResult(res => res.StatusCode == HttpStatusCode.RequestTimeout),
OnFallback = async args => await CallSecondary(args.Context.CancellationToken)
FallbackAction = async args => Outcome.FromResult(await CallSecondary(args.Context.CancellationToken))
})
.Build();

Expand Down
6 changes: 3 additions & 3 deletions src/Snippets/Docs/Fallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ private static ValueTask<HttpResponseMessage> ActionCore()
}
#endregion

private static ValueTask<HttpResponseMessage> CallPrimary(CancellationToken ct) => ValueTask.FromResult(new HttpResponseMessage());
private static ValueTask<HttpResponseMessage> CallSecondary(CancellationToken ct) => ValueTask.FromResult(new HttpResponseMessage());
private static ValueTask<HttpResponseMessage> CallPrimary(CancellationToken ct) => ValueTask.FromResult(new HttpResponseMessage(HttpStatusCode.RequestTimeout));
private static ValueTask<HttpResponseMessage> CallSecondary(CancellationToken ct) => ValueTask.FromResult(new HttpResponseMessage(HttpStatusCode.OK));
public static async Task<HttpResponseMessage?> AntiPattern_RetryForFallback()
{
var fallbackKey = new ResiliencePropertyKey<HttpResponseMessage?>("fallback_result");
Expand Down Expand Up @@ -190,7 +190,7 @@ private static ValueTask<HttpResponseMessage> ActionCore()
{
ShouldHandle = new PredicateBuilder<HttpResponseMessage>()
.HandleResult(res => res.StatusCode == HttpStatusCode.RequestTimeout),
OnFallback = async args => await CallSecondary(args.Context.CancellationToken)
FallbackAction = async args => Outcome.FromResult(await CallSecondary(args.Context.CancellationToken))
})
.Build();

Expand Down