Show / Hide Table of Contents

Class RetryUtil

Utilities for retries.

Inheritance
object
RetryUtil
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Cognite.Extractor.Common
Assembly: Cognite.Common.dll
Syntax
public static class RetryUtil

Methods

| Edit this page View Source

RetryAsync(string, Action, RetryUtilConfig, Func<Exception, bool>, ILogger, CancellationToken)

Retry the given method based on config.

Declaration
public static Task RetryAsync(string name, Action generator, RetryUtilConfig config, Func<Exception, bool> shouldRetry, ILogger logger, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Action generator

Method called once per retry.

RetryUtilConfig config

Retry config

Func<Exception, bool> shouldRetry

A method returning true if the method should continue after the given exception was thrown.

ILogger logger

Logger logging information about retries.

CancellationToken token

Cancellation token

Returns
Type Description
Task
Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

RetryAsync(string, Action, RetryUtilConfig, CancellationToken)

Retry the given method based on config.

Declaration
public static Task RetryAsync(string name, Action generator, RetryUtilConfig config, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Action generator

Method called once per retry.

RetryUtilConfig config

Retry config

CancellationToken token

Cancellation token

Returns
Type Description
Task
| Edit this page View Source

RetryAsync(string, Func<Task>, RetryUtilConfig, Func<Exception, bool>, ILogger, CancellationToken)

Retry the given method based on config.

Declaration
public static Task RetryAsync(string name, Func<Task> generator, RetryUtilConfig config, Func<Exception, bool> shouldRetry, ILogger logger, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Func<Task> generator

Method returning a task, called once per retry.

RetryUtilConfig config

Retry config

Func<Exception, bool> shouldRetry

A method returning true if the method should continue after the given exception was thrown.

ILogger logger

Logger logging information about retries.

CancellationToken token

Cancellation token

Returns
Type Description
Task
Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

RetryAsync(string, Func<Task>, RetryUtilConfig, CancellationToken)

Retry the given method based on config.

Declaration
public static Task RetryAsync(string name, Func<Task> generator, RetryUtilConfig config, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Func<Task> generator

Method returning a task, called once per retry.

RetryUtilConfig config

Retry config

CancellationToken token

Cancellation token

Returns
Type Description
Task
| Edit this page View Source

RetryResultAsync<T>(string, Func<Task<T>>, RetryUtilConfig, Func<Exception, bool>, ILogger, CancellationToken)

Retry the given method based on config, return a result of type T.

Declaration
public static Task<T> RetryResultAsync<T>(string name, Func<Task<T>> generator, RetryUtilConfig config, Func<Exception, bool> shouldRetry, ILogger logger, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Func<Task<T>> generator

Method returning a task, called once per retry.

RetryUtilConfig config

Retry config

Func<Exception, bool> shouldRetry

A method returning true if the method should continue after the given exception was thrown.

ILogger logger

Logger logging information about retries.

CancellationToken token

Cancellation token

Returns
Type Description
Task<T>
Type Parameters
Name Description
T
Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

RetryResultAsync<T>(string, Func<Task<T>>, RetryUtilConfig, CancellationToken)

Retry the given method based on config, return a result of type T.

Declaration
public static Task<T> RetryResultAsync<T>(string name, Func<Task<T>> generator, RetryUtilConfig config, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Func<Task<T>> generator

Method returning a task, called once per retry.

RetryUtilConfig config

Retry config

CancellationToken token

Cancellation token

Returns
Type Description
Task<T>
Type Parameters
Name Description
T
| Edit this page View Source

RetryResultAsync<T>(string, Func<T>, RetryUtilConfig, Func<Exception, bool>, ILogger, CancellationToken)

Retry the given method based on config, return a result of type T.

Declaration
public static Task<T> RetryResultAsync<T>(string name, Func<T> generator, RetryUtilConfig config, Func<Exception, bool> shouldRetry, ILogger logger, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Func<T> generator

Method called once per retry.

RetryUtilConfig config

Retry config

Func<Exception, bool> shouldRetry

A method returning true if the method should continue after the given exception was thrown.

ILogger logger

Logger logging information about retries.

CancellationToken token

Cancellation token

Returns
Type Description
Task<T>
Type Parameters
Name Description
T
Exceptions
Type Condition
ArgumentNullException
| Edit this page View Source

RetryResultAsync<T>(string, Func<T>, RetryUtilConfig, CancellationToken)

Retry the given method based on config, return a result of type T.

Declaration
public static Task<T> RetryResultAsync<T>(string name, Func<T> generator, RetryUtilConfig config, CancellationToken token)
Parameters
Type Name Description
string name

Name of the task being retried, for logging.

Func<T> generator

Method called once per retry.

RetryUtilConfig config

Retry config

CancellationToken token

Cancellation token

Returns
Type Description
Task<T>
Type Parameters
Name Description
T
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX