simplify while loop condition

This commit is contained in:
2026-07-13 01:40:57 +00:00
parent 6fe4a64562
commit 09d732ab41

View File

@@ -72,7 +72,10 @@ export class ExponentialBackoff {
let attempt = 0; let attempt = 0;
while (attempt < this.options.maxAttempts || this.options.maxAttempts == 0) { // If the max attempts is 0, we should continue indefinitely.
const unlimitedAttempts = this.options.maxAttempts === 0;
while (attempt < this.options.maxAttempts || unlimitedAttempts) {
try { try {
return await taskFn(); return await taskFn();
} catch (error) { } catch (error) {