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
optsNatsOptsThe NatsOpts instance containing configuration settings for intervals and jitter.
iterintThe current attempt iteration, used to calculate the exponential delay.
cancellationTokenCancellationTokenCancel back-off delay.
Returns
- Task
A task that completes after the calculated delay time has elapsed.