@gradientedge/commercetools-utils
    Preparing search index...

    Interface RetryOnConflictParams<T>

    interface RetryOnConflictParams<T = any> {
        delayMs?: number;
        executeFn: (attemptNo: number) => Promise<T>;
        jitter?: boolean;
        maxRetries?: number;
    }

    Type Parameters

    • T = any
    Index

    Properties

    delayMs?: number

    The number of milliseconds to wait before retrying a failed request. This will be increased exponentially CommercetoolsApi.calculateDelay. Defaults to 100.

    executeFn: (attemptNo: number) => Promise<T>

    Any function that returns a promise

    This function is expected to be able to throw a CommercetoolsError with a status code of 409. These errors should not be swallowed by the code in this function.

    jitter?: boolean

    If enabled, adds a random element to the exponential increase in retry time. See the following url for more details: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ We utilise the 'full' jitter + plus an additional decaying variance.

    maxRetries?: number

    The maximum number of times that we'll call the executeFn function before returning the error caught from the last failure. Defaults to 3.