simplify while loop condition
This commit is contained in:
@@ -72,7 +72,10 @@ export class ExponentialBackoff {
|
||||
|
||||
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 {
|
||||
return await taskFn();
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user