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

Provides common functionality to retry logic with configurable delay. More...

Static Public Member Functions

static void RunWithRetries (this Action action, int retries, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
static void RunWithRetries (this Action action, int retries, TimeSpan[] retryDelays, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
static T RunWithRetries< T > (this Func< T > func, int retries, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
 Runs the provided function with the requested number of retries and provided backoff delays.
static T RunWithRetries< T > (this Func< T > func, int retries, TimeSpan[] retryDelays, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
 Runs the provided function with the requested number of retries and provided backoff delays.
static async Task RunWithRetries (this Func< Task > asyncFunc, int retries, TimeSpan[] retryDelays, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
static async Task< T > RunWithRetries< T > (this Func< Task< T > > func, int retries, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
 Runs the provided function with the requested number of retries and provided backoff delays.
static async Task< T > RunWithRetries< T > (this Func< Task< T > > func, int retries, TimeSpan[] retryDelays, [CallerFilePath] string callerFilePath=null, [CallerLineNumber] int callerLineNumber=-1, [CallerMemberName] string callerMemberName=null)
 Runs the provided function with the requested number of retries and provided backoff delays.

Detailed Description

Provides common functionality to retry logic with configurable delay.

Member Function Documentation

◆ RunWithRetries() [1/3]

void PeanutButter.Utils.RetryExtensions.RunWithRetries ( this Action action,
int retries,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static
Parameters
action
retries
callerFilePathdo not set - automatically set by the compiler
callerLineNumberdo not set - automatically set by the compiler
callerMemberNamedo not set - automatically set by the compiler

◆ RunWithRetries() [2/3]

void PeanutButter.Utils.RetryExtensions.RunWithRetries ( this Action action,
int retries,
TimeSpan[] retryDelays,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static
Parameters
action
retries
retryDelays
callerFilePathdo not set - automatically set by the compiler
callerLineNumberdo not set - automatically set by the compiler
callerMemberNamedo not set - automatically set by the compiler

◆ RunWithRetries() [3/3]

async Task PeanutButter.Utils.RetryExtensions.RunWithRetries ( this Func< Task > asyncFunc,
int retries,
TimeSpan[] retryDelays,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static
Parameters
asyncFunc
retries
retryDelays
callerFilePath
callerLineNumber
callerMemberName

◆ RunWithRetries< T >() [1/4]

T PeanutButter.Utils.RetryExtensions.RunWithRetries< T > ( this Func< T > func,
int retries,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static

Runs the provided function with the requested number of retries and provided backoff delays.

Parameters
func
retries
callerFilePathdo not set - automatically set by the compiler
callerLineNumberdo not set - automatically set by the compiler
callerMemberNamedo not set - automatically set by the compiler
Template Parameters
T
Returns
Exceptions
ArgumentNullException
ArgumentException

◆ RunWithRetries< T >() [2/4]

T PeanutButter.Utils.RetryExtensions.RunWithRetries< T > ( this Func< T > func,
int retries,
TimeSpan[] retryDelays,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static

Runs the provided function with the requested number of retries and provided backoff delays.

Parameters
func
retries
retryDelays
callerFilePathdo not set - automatically set by the compiler
callerLineNumberdo not set - automatically set by the compiler
callerMemberNamedo not set - automatically set by the compiler
Template Parameters
T
Returns
Exceptions
ArgumentNullException
ArgumentException

◆ RunWithRetries< T >() [3/4]

async Task< T > PeanutButter.Utils.RetryExtensions.RunWithRetries< T > ( this Func< Task< T > > func,
int retries,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static

Runs the provided function with the requested number of retries and provided backoff delays.

Parameters
func
retries
callerFilePathdo not set - automatically set by the compiler
callerLineNumberdo not set - automatically set by the compiler
callerMemberNamedo not set - automatically set by the compiler
Template Parameters
T
Returns
Exceptions
ArgumentNullException
ArgumentException

◆ RunWithRetries< T >() [4/4]

async Task< T > PeanutButter.Utils.RetryExtensions.RunWithRetries< T > ( this Func< Task< T > > func,
int retries,
TimeSpan[] retryDelays,
[CallerFilePath] string callerFilePath = null,
[CallerLineNumber] int callerLineNumber = -1,
[CallerMemberName] string callerMemberName = null )
static

Runs the provided function with the requested number of retries and provided backoff delays.

Parameters
func
retries
retryDelays
callerFilePathdo not set - automatically set by the compiler
callerLineNumberdo not set - automatically set by the compiler
callerMemberNamedo not set - automatically set by the compiler
Template Parameters
T
Returns
Exceptions
ArgumentNullException
ArgumentException

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