| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ccc228b commit 7a32198
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3223,7 +3223,8 @@ changes: | |||
| 3223 | 3223 | - version: REPLACEME | |
| 3224 | 3224 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 3225 | 3225 | description: The `maxBusyTries` option is renamed to `maxRetries`, and its | |
| 3226 | - default is 0. | ||
| 3226 | + default is 0. The `emfileWait` option has been removed, and | ||
| 3227 | + `EMFILE` errors use the same retry logic as other errors. | ||
| 3227 | 3228 | - version: v12.10.0 | |
| 3228 | 3229 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 3229 | 3230 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -3246,14 +3247,11 @@ changes: | |||
| 3246 | 3247 | ||
| 3247 | 3248 | * `path` {string|Buffer|URL} | |
| 3248 | 3249 | * `options` {Object} | |
| 3249 | - * `emfileWait` {integer} If an `EMFILE` error is encountered, Node.js will | ||
| 3250 | - retry the operation with a linear backoff of 1ms longer on each try until the | ||
| 3251 | - timeout duration passes this limit. This option is ignored if the `recursive` | ||
| 3252 | - option is not `true`. **Default:** `1000`. | ||
| 3253 | - * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is | ||
| 3254 | - encountered, Node.js will retry the operation with a linear backoff wait of | ||
| 3255 | - 100ms longer on each try. This option represents the number of retries. This | ||
| 3256 | - option is ignored if the `recursive` option is not `true`. **Default:** `0`. | ||
| 3250 | + * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENOTEMPTY`, or `EPERM` | ||
| 3251 | + error is encountered, Node.js will retry the operation with a linear backoff | ||
| 3252 | + wait of 100ms longer on each try. This option represents the number of | ||
| 3253 | + retries. This option is ignored if the `recursive` option is not `true`. | ||
| 3254 | + **Default:** `0`. | ||
| 3257 | 3255 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 3258 | 3256 | recursive mode, errors are not reported if `path` does not exist, and | |
| 3259 | 3257 | operations are retried on failure. **Default:** `false`. | |
@@ -3273,7 +3271,8 @@ changes: | |||
| 3273 | 3271 | - version: REPLACEME | |
| 3274 | 3272 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 3275 | 3273 | description: The `maxBusyTries` option is renamed to `maxRetries`, and its | |
| 3276 | - default is 0. | ||
| 3274 | + default is 0. The `emfileWait` option has been removed, and | ||
| 3275 | + `EMFILE` errors use the same retry logic as other errors. | ||
| 3277 | 3276 | - version: v12.10.0 | |
| 3278 | 3277 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 3279 | 3278 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -5005,7 +5004,8 @@ changes: | |||
| 5005 | 5004 | - version: REPLACEME | |
| 5006 | 5005 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 5007 | 5006 | description: The `maxBusyTries` option is renamed to `maxRetries`, and its | |
| 5008 | - default is 0. | ||
| 5007 | + default is 0. The `emfileWait` option has been removed, and | ||
| 5008 | + `EMFILE` errors use the same retry logic as other errors. | ||
| 5009 | 5009 | - version: v12.10.0 | |
| 5010 | 5010 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 5011 | 5011 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -5016,14 +5016,11 @@ changes: | |||
| 5016 | 5016 | ||
| 5017 | 5017 | * `path` {string|Buffer|URL} | |
| 5018 | 5018 | * `options` {Object} | |
| 5019 | - * `emfileWait` {integer} If an `EMFILE` error is encountered, Node.js will | ||
| 5020 | - retry the operation with a linear backoff of 1ms longer on each try until the | ||
| 5021 | - timeout duration passes this limit. This option is ignored if the `recursive` | ||
| 5022 | - option is not `true`. **Default:** `1000`. | ||
| 5023 | - * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is | ||
| 5024 | - encountered, Node.js will retry the operation with a linear backoff wait of | ||
| 5025 | - 100ms longer on each try. This option represents the number of retries. This | ||
| 5026 | - option is ignored if the `recursive` option is not `true`. **Default:** `0`. | ||
| 5019 | + * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENOTEMPTY`, or `EPERM` | ||
| 5020 | + error is encountered, Node.js will retry the operation with a linear backoff | ||
| 5021 | + wait of 100ms longer on each try. This option represents the number of | ||
| 5022 | + retries. This option is ignored if the `recursive` option is not `true`. | ||
| 5023 | + **Default:** `0`. | ||
| 5027 | 5024 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 5028 | 5025 | recursive mode, errors are not reported if `path` does not exist, and | |
| 5029 | 5026 | operations are retried on failure. **Default:** `false`. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,26 +22,22 @@ const { | |||
| 22 | 22 | const { join } = require('path'); | |
| 23 | 23 | const { setTimeout } = require('timers'); | |
| 24 | 24 | const notEmptyErrorCodes = new Set(['ENOTEMPTY', 'EEXIST', 'EPERM']); | |
| 25 | + const retryErrorCodes = new Set(['EBUSY', 'EMFILE', 'ENOTEMPTY', 'EPERM']); | ||
| 25 | 26 | const isWindows = process.platform === 'win32'; | |
| 26 | 27 | const epermHandler = isWindows ? fixWinEPERM : _rmdir; | |
| 27 | 28 | const epermHandlerSync = isWindows ? fixWinEPERMSync : _rmdirSync; | |
| 28 | 29 | ||
| 29 | 30 | ||
| 30 | 31 | function rimraf(path, options, callback) { | |
| 31 | - let timeout = 0; // For EMFILE handling. | ||
| 32 | 32 | let retries = 0; | |
| 33 | 33 | ||
| 34 | 34 | _rimraf(path, options, function CB(err) { | |
| 35 | 35 | if (err) { | |
| 36 | - if ((err.code === 'EBUSY' || err.code === 'ENOTEMPTY' || | ||
| 37 | - err.code === 'EPERM') && retries < options.maxRetries) { | ||
| 36 | + if (retryErrorCodes.has(err.code) && retries < options.maxRetries) { | ||
| 38 | 37 | retries++; | |
| 39 | 38 | return setTimeout(_rimraf, retries * 100, path, options, CB); | |
| 40 | 39 | } | |
| 41 | 40 | ||
| 42 | - if (err.code === 'EMFILE' && timeout < options.emfileWait) | ||
| 43 | - return setTimeout(_rimraf, timeout++, path, options, CB); | ||
| 44 | - | ||
| 45 | 41 | // The file is already gone. | |
| 46 | 42 | if (err.code === 'ENOENT') | |
| 47 | 43 | err = null; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ const { | |||
| 24 | 24 | const { once } = require('internal/util'); | |
| 25 | 25 | const { toPathIfFileURL } = require('internal/url'); | |
| 26 | 26 | const { | |
| 27 | - validateInt32, | ||
| 28 | 27 | validateUint32 | |
| 29 | 28 | } = require('internal/validators'); | |
| 30 | 29 | const pathModule = require('path'); | |
@@ -563,7 +562,6 @@ function warnOnNonPortableTemplate(template) { | |||
| 563 | 562 | } | |
| 564 | 563 | ||
| 565 | 564 | const defaultRmdirOptions = { | |
| 566 | - emfileWait: 1000, | ||
| 567 | 565 | maxRetries: 0, | |
| 568 | 566 | recursive: false, | |
| 569 | 567 | }; | |
@@ -579,7 +577,6 @@ const validateRmdirOptions = hideStackFrames((options) => { | |||
| 579 | 577 | if (typeof options.recursive !== 'boolean') | |
| 580 | 578 | throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', options.recursive); | |
| 581 | 579 | ||
| 582 | - validateInt32(options.emfileWait, 'emfileWait', 0); | ||
| 583 | 580 | validateUint32(options.maxRetries, 'maxRetries'); | |
| 584 | 581 | ||
| 585 | 582 | return options; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,12 +155,10 @@ function removeAsync(dir) { | |||
| 155 | 155 | // Test input validation. | |
| 156 | 156 | { | |
| 157 | 157 | const defaults = { | |
| 158 | - emfileWait: 1000, | ||
| 159 | 158 | maxRetries: 0, | |
| 160 | 159 | recursive: false | |
| 161 | 160 | }; | |
| 162 | 161 | const modified = { | |
| 163 | - emfileWait: 953, | ||
| 164 | 162 | maxRetries: 5, | |
| 165 | 163 | recursive: true | |
| 166 | 164 | }; | |
@@ -171,7 +169,6 @@ function removeAsync(dir) { | |||
| 171 | 169 | assert.deepStrictEqual(validateRmdirOptions({ | |
| 172 | 170 | maxRetries: 99 | |
| 173 | 171 | }), { | |
| 174 | - emfileWait: 1000, | ||
| 175 | 172 | maxRetries: 99, | |
| 176 | 173 | recursive: false | |
| 177 | 174 | }); | |
@@ -196,14 +193,6 @@ function removeAsync(dir) { | |||
| 196 | 193 | }); | |
| 197 | 194 | }); | |
| 198 | 195 | ||
| 199 | - common.expectsError(() => { | ||
| 200 | - validateRmdirOptions({ emfileWait: -1 }); | ||
| 201 | - }, { | ||
| 202 | - code: 'ERR_OUT_OF_RANGE', | ||
| 203 | - type: RangeError, | ||
| 204 | - message: /^The value of "emfileWait" is out of range\./ | ||
| 205 | - }); | ||
| 206 | - | ||
| 207 | 196 | common.expectsError(() => { | |
| 208 | 197 | validateRmdirOptions({ maxRetries: -1 }); | |
| 209 | 198 | }, { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments