Method BackoffWithJitterAsync
BackoffWithJitterAsync(NatsOpts, int, CancellationToken)
Applies an exponential backoff delay with an added random jitter for attempts.
public static Task BackoffWithJitterAsync(this NatsOpts opts, int iter, CancellationToken cancellationToken = default)
Parameters
opts
NatsOptsThe NatsOpts instance containing configuration settings for intervals and jitter.
iter
intThe current attempt iteration, used to calculate the exponential delay.
cancellationToken
CancellationTokenCancel back-off delay.
Returns
- Task
A task that completes after the calculated delay time has elapsed.