docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IRetryPolicy

    Interface which abstracts Retry Policies.

    Namespace: Unity.Cloud.Common
    Assembly: Unity.Cloud.Common.dll
    Syntax
    public interface IRetryPolicy

    Methods

    ExecuteAsync<T>(RetriedOperation<T>, ShouldRetryChecker<T>, CancellationToken, IProgress<RetryQueuedProgress>)

    An async method that can retry an operation if it hasn't succeeded.

    Declaration
    Task<T> ExecuteAsync<T>(IRetryPolicy.RetriedOperation<T> retriedOperation, IRetryPolicy.ShouldRetryChecker<T> shouldRetryChecker, CancellationToken cancellationToken = default, IProgress<RetryQueuedProgress> progress = null)
    Parameters
    Type Name Description
    IRetryPolicy.RetriedOperation<T> retriedOperation

    The IRetryPolicy.RetriedOperation<T> that needs to be performed.

    IRetryPolicy.ShouldRetryChecker<T> shouldRetryChecker

    A IRetryPolicy.ShouldRetryChecker<T> that helps determine whether the retriedOperation should be retried.

    CancellationToken cancellationToken

    Token to cancel the task execution.

    IProgress<RetryQueuedProgress> progress

    Provider for progress updates on queued retries.

    Returns
    Type Description
    Task<T>

    The result of the retriedOperation, if available, after shouldRetryChecker returns false.

    Type Parameters
    Name Description
    T

    The type of the result for the operation.

    Exceptions
    Type Condition
    RetryExecutionFailedException
    • When shouldRetryChecker returns false after retriedOperation throws an exception, in which case the internal exception is passed through the former's innerException field.
    • When shouldRetryChecker throws an RetryExecutionFailedException, in which case this exception is immediately bubbled up.
    TimeoutException

    When the retry policy expires.

    OperationCanceledException

    When the retriedOperation or the cancellationToken is cancelled.

    InvalidArgumentException
    • When shouldRetryChecker throws an invalid exception.
    • When shouldRetryChecker does not await the completion of operationTask.

    Extension Methods

    RetryPolicyExtensions.ExecuteAsyncWithExceptionValidation(IRetryPolicy, IRetryPolicy.RetriedOperation, IRetryPolicy.ShouldRetryExceptionChecker, CancellationToken, IProgress<RetryQueuedProgress>)
    RetryPolicyExtensions.ExecuteAsyncWithExceptionValidation<T>(IRetryPolicy, IRetryPolicy.RetriedOperation<T>, IRetryPolicy.ShouldRetryExceptionChecker, CancellationToken, IProgress<RetryQueuedProgress>)
    RetryPolicyExtensions.ExecuteAsyncWithResultValidation<T>(IRetryPolicy, IRetryPolicy.RetriedOperation<T>, IRetryPolicy.ShouldRetryResultChecker<T>, CancellationToken, IProgress<RetryQueuedProgress>)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)