| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5523950 commit 7e1dee3
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -209,12 +209,19 @@ function _rmdirSync(path, options, originalErr) { | |||
| 209 | 209 | rimrafSync(join(path, child), options); | |
| 210 | 210 | }); | |
| 211 | 211 | ||
| 212 | - for (let i = 1; i <= options.maxRetries + 1; i++) { | ||
| 212 | + const tries = options.maxRetries + 1; | ||
| 213 | + | ||
| 214 | + for (let i = 1; i <= tries; i++) { | ||
| 213 | 215 | try { | |
| 214 | 216 | return rmdirSync(path, options); | |
| 215 | - } catch { | ||
| 216 | - if (options.retryDelay > 0) | ||
| 217 | + } catch (err) { | ||
| 218 | + // Only sleep if this is not the last try, and the delay is greater | ||
| 219 | + // than zero, and an error was encountered that warrants a retry. | ||
| 220 | + if (retryErrorCodes.has(err.code) && | ||
| 221 | + i < tries && | ||
| 222 | + options.retryDelay > 0) { | ||
| 217 | 223 | sleep(i * options.retryDelay); | |
| 224 | + } | ||
| 218 | 225 | } | |
| 219 | 226 | } | |
| 220 | 227 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments