| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e1eb6a6 commit 4e05bf0
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,6 +21,7 @@ const { | |||
| 21 | 21 | } = require('fs'); | |
| 22 | 22 | const { join } = require('path'); | |
| 23 | 23 | const { setTimeout } = require('timers'); | |
| 24 | + const { sleep } = require('internal/util'); | ||
| 24 | 25 | const notEmptyErrorCodes = new Set(['ENOTEMPTY', 'EEXIST', 'EPERM']); | |
| 25 | 26 | const retryErrorCodes = new Set( | |
| 26 | 27 | ['EBUSY', 'EMFILE', 'ENFILE', 'ENOTEMPTY', 'EPERM']); | |
@@ -208,10 +209,13 @@ function _rmdirSync(path, options, originalErr) { | |||
| 208 | 209 | rimrafSync(join(path, child), options); | |
| 209 | 210 | }); | |
| 210 | 211 | ||
| 211 | - for (let i = 0; i < options.maxRetries + 1; i++) { | ||
| 212 | + for (let i = 1; i <= options.maxRetries + 1; i++) { | ||
| 212 | 213 | try { | |
| 213 | 214 | return rmdirSync(path, options); | |
| 214 | - } catch {} // Ignore errors. | ||
| 215 | + } catch { | ||
| 216 | + if (options.retryDelay > 0) | ||
| 217 | + sleep(i * options.retryDelay); | ||
| 218 | + } | ||
| 215 | 219 | } | |
| 216 | 220 | } | |
| 217 | 221 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments