diff --git a/source/exponential-backoff.ts b/source/exponential-backoff.ts index b19bdeb..f2cd4b0 100644 --- a/source/exponential-backoff.ts +++ b/source/exponential-backoff.ts @@ -88,7 +88,7 @@ export class ExponentialBackoff { // If the max attempts is 0, we should continue indefinitely. const unlimitedAttempts = this.options.maxAttempts === 0; - while (attempt < this.options.maxAttempts || unlimitedAttempts) { + while (unlimitedAttempts || attempt < this.options.maxAttempts) { try { // Await the promise before returning so its execution context remains in the try-catch // If we didn't await, this `run` function would successfully return and any errors would not be caught here.