0Pricing
C# Academy · Lesson

Timeout and Fallback Policies

Bound waits and provide graceful fallbacks.

Why Timeouts Matter

A call that never returns is worse than one that fails: it ties up threads and connections. A timeout strategy caps how long an operation may run before Polly cancels it.

Adding A Timeout

Polly v8 provides AddTimeout. When the limit is exceeded it throws a TimeoutRejectedException and cancels the underlying token.

using Polly.Timeout;

var pipeline = new ResiliencePipelineBuilder()
    .AddTimeout(TimeSpan.FromSeconds(3))
    .Build();

All lessons in this course

  1. Retry Policies
  2. Circuit Breaker Pattern
  3. Timeout and Fallback Policies
  4. Resilience Pipelines
← Back to C# Academy