Table of Contents

Class SimpleRetryPolicy<T>

Namespace
DotCompute.Backends.Metal.Utilities
Assembly
DotCompute.Backends.Metal.dll

Generic implementation of retry policy for Metal operations.

public sealed class SimpleRetryPolicy<T> : IAsyncPolicy<T>

Type Parameters

T

The return type.

Inheritance
SimpleRetryPolicy<T>
Implements
Inherited Members

Remarks

Initializes a new instance of the SimpleRetryPolicy<T> class.

Constructors

SimpleRetryPolicy(int, TimeSpan, ILogger?)

Generic implementation of retry policy for Metal operations.

public SimpleRetryPolicy(int maxRetries = 3, TimeSpan delay = default, ILogger? logger = null)

Parameters

maxRetries int

Maximum number of retries.

delay TimeSpan

Delay between retries.

logger ILogger

Logger for diagnostics.

Remarks

Initializes a new instance of the SimpleRetryPolicy<T> class.

Methods

ExecuteAsync(Func<Task<T>>, CancellationToken)

Executes a function with retry logic.

public Task<T> ExecuteAsync(Func<Task<T>> operation, CancellationToken cancellationToken = default)

Parameters

operation Func<Task<T>>

The operation to execute.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<T>

A task representing the operation with a return value.