PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.TimeBasedRetryContext Class Reference

Provides a wrapping context around retried code. More...

Public Member Functions

 TimeBasedRetryContext (TimeSpan maxRunTime, Func< IBackoffStrategy > defaultBackoffStrategyFactory)
 Constructs the context with the timeout and a mechanism for backing off on failure.
void Do (Action action)
 Attempt to run the action until it either succeeds or times out.
void Do (Action action, IBackoffStrategy backoffStrategy)
 Attempt to run the action until it either succeeds or times out.
Do< T > (Func< T > func)
 Attempt to run the func until it either succeeds or times out, returning the first successful value.
Do< T > (Func< T > func, IBackoffStrategy backoffStrategy)
 Attempt to run the func until it either succeeds or times out, returning the first successful value.

Detailed Description

Provides a wrapping context around retried code.

Constructor & Destructor Documentation

◆ TimeBasedRetryContext()

PeanutButter.Utils.TimeBasedRetryContext.TimeBasedRetryContext ( TimeSpan maxRunTime,
Func< IBackoffStrategy > defaultBackoffStrategyFactory )

Constructs the context with the timeout and a mechanism for backing off on failure.

Parameters
maxRunTime
defaultBackoffStrategyFactory

Member Function Documentation

◆ Do() [1/2]

void PeanutButter.Utils.TimeBasedRetryContext.Do ( Action action)

Attempt to run the action until it either succeeds or times out.

Parameters
action

◆ Do() [2/2]

void PeanutButter.Utils.TimeBasedRetryContext.Do ( Action action,
IBackoffStrategy backoffStrategy )

Attempt to run the action until it either succeeds or times out.

Parameters
action
backoffStrategy

◆ Do< T >() [1/2]

Attempt to run the func until it either succeeds or times out, returning the first successful value.

Parameters
func

◆ Do< T >() [2/2]

T PeanutButter.Utils.TimeBasedRetryContext.Do< T > ( Func< T > func,
IBackoffStrategy backoffStrategy )

Attempt to run the func until it either succeeds or times out, returning the first successful value.

Parameters
func
backoffStrategy

The documentation for this class was generated from the following file:
  • source/Utils/PeanutButter.Utils/TimeBasedRetryContext.cs