(retries?: number)
| 102 | } |
| 103 | |
| 104 | retries(retries?: number) { |
| 105 | if (typeof retries !== "undefined") { |
| 106 | if (retries > this.#maxRetries) { |
| 107 | console.error( |
| 108 | `Can't set retries ${retries} higher than maxRetries (${ |
| 109 | this.#maxRetries |
| 110 | }), setting to maxRetries instead.` |
| 111 | ); |
| 112 | this.#retries = this.#maxRetries; |
| 113 | } else { |
| 114 | this.#retries = retries; |
| 115 | } |
| 116 | } |
| 117 | return this.#clone(); |
| 118 | } |
| 119 | |
| 120 | async *retryAsync(maxRetries: number = this.#maxRetries ?? Infinity) { |
| 121 | let elapsed = 0; |