Skip to main content
The timeout strategy ensures that operations do not execute for longer than a configured duration.

TimeoutStrategyOptions

Configures the timeout resilience strategy.

Properties

TimeSpan
default:"00:00:30"
The default timeout duration.
  • Must be greater than 10 milliseconds
  • Must be less than 24 hours
  • Default is 30 seconds
Func<TimeoutGeneratorArguments, ValueTask<TimeSpan>>?
default:"null"
A generator that produces the timeout for a given execution.When null, the Timeout property value is used instead.Special values:
  • Return TimeSpan.Zero or negative value: Strategy does nothing
  • Return Timeout.InfiniteTimeSpan: Disable timeout for the execution
Func<OnTimeoutArguments, ValueTask>?
default:"null"
A delegate that is invoked when a timeout occurs.

Extension Methods

Add timeout strategies to a resilience pipeline:

OnTimeoutArguments

Arguments passed to the OnTimeout callback.

Usage Example

Dynamic Timeouts

Use TimeoutGenerator for per-execution timeout values: