| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dfb86f9 commit 022ecbd
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3222,7 +3222,8 @@ added: v0.0.2 | |||
| 3222 | 3222 | changes: | |
| 3223 | 3223 | - version: REPLACEME | |
| 3224 | 3224 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 3225 | - description: The `maxBusyTries` option is renamed to `maxRetries`. | ||
| 3225 | + description: The `maxBusyTries` option is renamed to `maxRetries`, and its | ||
| 3226 | + default is 0. | ||
| 3226 | 3227 | - version: v12.10.0 | |
| 3227 | 3228 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 3228 | 3229 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -3252,7 +3253,7 @@ changes: | |||
| 3252 | 3253 | * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is | |
| 3253 | 3254 | encountered, Node.js will retry the operation with a linear backoff wait of | |
| 3254 | 3255 | 100ms longer on each try. This option represents the number of retries. This | |
| 3255 | - option is ignored if the `recursive` option is not `true`. **Default:** `3`. | ||
| 3256 | + option is ignored if the `recursive` option is not `true`. **Default:** `0`. | ||
| 3256 | 3257 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 3257 | 3258 | recursive mode, errors are not reported if `path` does not exist, and | |
| 3258 | 3259 | operations are retried on failure. **Default:** `false`. | |
@@ -3271,7 +3272,8 @@ added: v0.1.21 | |||
| 3271 | 3272 | changes: | |
| 3272 | 3273 | - version: REPLACEME | |
| 3273 | 3274 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 3274 | - description: The `maxBusyTries` option is renamed to `maxRetries`. | ||
| 3275 | + description: The `maxBusyTries` option is renamed to `maxRetries`, and its | ||
| 3276 | + default is 0. | ||
| 3275 | 3277 | - version: v12.10.0 | |
| 3276 | 3278 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 3277 | 3279 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -3286,6 +3288,10 @@ changes: | |||
| 3286 | 3288 | ||
| 3287 | 3289 | * `path` {string|Buffer|URL} | |
| 3288 | 3290 | * `options` {Object} | |
| 3291 | + * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is | ||
| 3292 | + encountered, Node.js will retry the operation. This option represents the | ||
| 3293 | + number of retries. This option is ignored if the `recursive` option is not | ||
| 3294 | + `true`. **Default:** `0`. | ||
| 3289 | 3295 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 3290 | 3296 | recursive mode, errors are not reported if `path` does not exist, and | |
| 3291 | 3297 | operations are retried on failure. **Default:** `false`. | |
@@ -4998,7 +5004,8 @@ added: v10.0.0 | |||
| 4998 | 5004 | changes: | |
| 4999 | 5005 | - version: REPLACEME | |
| 5000 | 5006 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 5001 | - description: The `maxBusyTries` option is renamed to `maxRetries`. | ||
| 5007 | + description: The `maxBusyTries` option is renamed to `maxRetries`, and its | ||
| 5008 | + default is 0. | ||
| 5002 | 5009 | - version: v12.10.0 | |
| 5003 | 5010 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 5004 | 5011 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -5016,7 +5023,7 @@ changes: | |||
| 5016 | 5023 | * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is | |
| 5017 | 5024 | encountered, Node.js will retry the operation with a linear backoff wait of | |
| 5018 | 5025 | 100ms longer on each try. This option represents the number of retries. This | |
| 5019 | - option is ignored if the `recursive` option is not `true`. **Default:** `3`. | ||
| 5026 | + option is ignored if the `recursive` option is not `true`. **Default:** `0`. | ||
| 5020 | 5027 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 5021 | 5028 | recursive mode, errors are not reported if `path` does not exist, and | |
| 5022 | 5029 | operations are retried on failure. **Default:** `false`. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,19 +25,18 @@ const notEmptyErrorCodes = new Set(['ENOTEMPTY', 'EEXIST', 'EPERM']); | |||
| 25 | 25 | const isWindows = process.platform === 'win32'; | |
| 26 | 26 | const epermHandler = isWindows ? fixWinEPERM : _rmdir; | |
| 27 | 27 | const epermHandlerSync = isWindows ? fixWinEPERMSync : _rmdirSync; | |
| 28 | - const numRetries = isWindows ? 100 : 1; | ||
| 29 | 28 | ||
| 30 | 29 | ||
| 31 | 30 | function rimraf(path, options, callback) { | |
| 32 | 31 | let timeout = 0; // For EMFILE handling. | |
| 33 | - let busyTries = 0; | ||
| 32 | + let retries = 0; | ||
| 34 | 33 | ||
| 35 | 34 | _rimraf(path, options, function CB(err) { | |
| 36 | 35 | if (err) { | |
| 37 | 36 | if ((err.code === 'EBUSY' || err.code === 'ENOTEMPTY' || | |
| 38 | - err.code === 'EPERM') && busyTries < options.maxRetries) { | ||
| 39 | - busyTries++; | ||
| 40 | - return setTimeout(_rimraf, busyTries * 100, path, options, CB); | ||
| 37 | + err.code === 'EPERM') && retries < options.maxRetries) { | ||
| 38 | + retries++; | ||
| 39 | + return setTimeout(_rimraf, retries * 100, path, options, CB); | ||
| 41 | 40 | } | |
| 42 | 41 | ||
| 43 | 42 | if (err.code === 'EMFILE' && timeout < options.emfileWait) | |
@@ -211,7 +210,7 @@ function _rmdirSync(path, options, originalErr) { | |||
| 211 | 210 | rimrafSync(join(path, child), options); | |
| 212 | 211 | }); | |
| 213 | 212 | ||
| 214 | - for (let i = 0; i < numRetries; i++) { | ||
| 213 | + for (let i = 0; i < options.maxRetries + 1; i++) { | ||
| 215 | 214 | try { | |
| 216 | 215 | return rmdirSync(path, options); | |
| 217 | 216 | } catch {} // Ignore errors. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -564,7 +564,7 @@ function warnOnNonPortableTemplate(template) { | |||
| 564 | 564 | ||
| 565 | 565 | const defaultRmdirOptions = { | |
| 566 | 566 | emfileWait: 1000, | |
| 567 | - maxRetries: 3, | ||
| 567 | + maxRetries: 0, | ||
| 568 | 568 | recursive: false, | |
| 569 | 569 | }; | |
| 570 | 570 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -156,7 +156,7 @@ function removeAsync(dir) { | |||
| 156 | 156 | { | |
| 157 | 157 | const defaults = { | |
| 158 | 158 | emfileWait: 1000, | |
| 159 | - maxRetries: 3, | ||
| 159 | + maxRetries: 0, | ||
| 160 | 160 | recursive: false | |
| 161 | 161 | }; | |
| 162 | 162 | const modified = { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments