Table of Contents

Struct OnHedgingArguments<TResult>

Namespace
Polly.Hedging
Assembly
Polly.Core.dll

Represents arguments used by the on-hedging event.

public readonly struct OnHedgingArguments<TResult>

Type Parameters

TResult

The type of result.

Inherited Members

Remarks

Always use the constructor when creating this struct, otherwise we do not guarantee binary compatibility.

Constructors

OnHedgingArguments(ResilienceContext, Outcome<TResult>?, int, TimeSpan)

Initializes a new instance of the OnHedgingArguments<TResult> struct.

public OnHedgingArguments(ResilienceContext context, Outcome<TResult>? outcome, int attemptNumber, TimeSpan duration)

Parameters

context ResilienceContext

The outcome of the resilience operation or event.

outcome Outcome<TResult>?

The context in which the resilience operation or event occurred.

attemptNumber int

The zero-based hedging attempt number.

duration TimeSpan

The execution duration of hedging attempt or the hedging delay in case the attempt was not finished in time.

Properties

AttemptNumber

Gets the zero-based hedging attempt number.

public int AttemptNumber { get; }

Property Value

int

Context

Gets the context of this event.

public ResilienceContext Context { get; }

Property Value

ResilienceContext

Duration

Gets the execution duration of hedging attempt or the hedging delay in case the attempt was not finished in time.

public TimeSpan Duration { get; }

Property Value

TimeSpan

Outcome

Gets the outcome that needs to be hedged, if any.

public Outcome<TResult>? Outcome { get; }

Property Value

Outcome<TResult>?

Remarks

If this property is null, it's an indication that user-callback or hedged operation did not complete within the hedging delay.