(maxRetries: number = this.#maxRetries ?? Infinity)
| 118 | } |
| 119 | |
| 120 | async *retryAsync(maxRetries: number = this.#maxRetries ?? Infinity) { |
| 121 | let elapsed = 0; |
| 122 | let retry = 0; |
| 123 | |
| 124 | while (retry <= maxRetries) { |
| 125 | const delay = this.delay(retry); |
| 126 | elapsed += delay; |
| 127 | |
| 128 | if (elapsed > this.#maxElapsed) { |
| 129 | break; |
| 130 | } |
| 131 | |
| 132 | yield { |
| 133 | delay: { |
| 134 | seconds: delay, |
| 135 | milliseconds: delay * 1000, |
| 136 | }, |
| 137 | retry, |
| 138 | }; |
| 139 | |
| 140 | retry++; |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | async *[Symbol.asyncIterator]() { |
| 145 | yield* this.retryAsync(); |
no test coverage detected