utils/retry
@ckeditor/ckeditor5-utils/src/retry
Filtering
Functions
-
exponentialDelay( options = { [options.delay], [options.factor], [options.maxDelay] } ) → ( number ) => number
module:utils/retry~exponentialDelay
Creates a function that calculates exponential back-off delay. Pass it as
options.retryDelay
toretry
.Parameters
options : object
-
Properties
[ options.delay ] : number
Base delay between invocations. Defaults to 1s.
[ options.factor ] : number
How much to increase the delay. Defaults to 2x.
[ options.maxDelay ] : number
Maximum timeout. Even if higher timeout is calculated, it cannot get higher than this value. Default to 10s.
Defaults to
{}
Returns
( number ) => number
The function calculating the delay.
-
retry( callback, options = { [options.maxAttempts], [options.retryDelay], [options.signal] } ) → Promise<TResult>
module:utils/retry~retry
Tries calling the given callback until it sucessfully resolves.
If the callback fails
maxRetries
times, the returned promise is rejected with the last error.Type parameters
TResult
The result of a successful callback invocation.
Parameters
callback : () => Promise<TResult>
The function to call until it succeeds.
options : object
-
Properties
[ options.maxAttempts ] : number
[ options.retryDelay ] : ( number ) => number
[ options.signal ] : AbortSignal
The signal to abort further retries. The callback itself is not aborted automatically.
Defaults to
{}
Returns
Promise<TResult>
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.