| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7a32198 commit f9d8494
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3224,7 +3224,8 @@ changes: | |||
| 3224 | 3224 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 3225 | 3225 | description: The `maxBusyTries` option is renamed to `maxRetries`, and its | |
| 3226 | 3226 | default is 0. The `emfileWait` option has been removed, and | |
| 3227 | - `EMFILE` errors use the same retry logic as other errors. | ||
| 3227 | + `EMFILE` errors use the same retry logic as other errors. The | ||
| 3228 | + `retryDelay` option is now supported. | ||
| 3228 | 3229 | - version: v12.10.0 | |
| 3229 | 3230 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 3230 | 3231 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -3249,12 +3250,15 @@ changes: | |||
| 3249 | 3250 | * `options` {Object} | |
| 3250 | 3251 | * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENOTEMPTY`, or `EPERM` | |
| 3251 | 3252 | 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`. | ||
| 3253 | + wait of `retryDelay` ms longer on each try. This option represents the number | ||
| 3254 | + of retries. This option is ignored if the `recursive` option is not `true`. | ||
| 3254 | 3255 | **Default:** `0`. | |
| 3255 | 3256 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 3256 | 3257 | recursive mode, errors are not reported if `path` does not exist, and | |
| 3257 | 3258 | operations are retried on failure. **Default:** `false`. | |
| 3259 | + * `retryDelay` {integer} The amount of time in milliseconds to wait between | ||
| 3260 | + retries. This option is ignored if the `recursive` option is not `true`. | ||
| 3261 | + **Default:** `100`. | ||
| 3258 | 3262 | * `callback` {Function} | |
| 3259 | 3263 | * `err` {Error} | |
| 3260 | 3264 | ||
@@ -3272,7 +3276,8 @@ changes: | |||
| 3272 | 3276 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 3273 | 3277 | description: The `maxBusyTries` option is renamed to `maxRetries`, and its | |
| 3274 | 3278 | default is 0. The `emfileWait` option has been removed, and | |
| 3275 | - `EMFILE` errors use the same retry logic as other errors. | ||
| 3279 | + `EMFILE` errors use the same retry logic as other errors. The | ||
| 3280 | + `retryDelay` option is now supported. | ||
| 3276 | 3281 | - version: v12.10.0 | |
| 3277 | 3282 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 3278 | 3283 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -3294,6 +3299,9 @@ changes: | |||
| 3294 | 3299 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 3295 | 3300 | recursive mode, errors are not reported if `path` does not exist, and | |
| 3296 | 3301 | operations are retried on failure. **Default:** `false`. | |
| 3302 | + * `retryDelay` {integer} The amount of time in milliseconds to wait between | ||
| 3303 | + retries. This option is ignored if the `recursive` option is not `true`. | ||
| 3304 | + **Default:** `100`. | ||
| 3297 | 3305 | ||
| 3298 | 3306 | Synchronous rmdir(2). Returns `undefined`. | |
| 3299 | 3307 | ||
@@ -5005,7 +5013,8 @@ changes: | |||
| 5005 | 5013 | pr-url: https://github.com/nodejs/node/pull/30644 | |
| 5006 | 5014 | description: The `maxBusyTries` option is renamed to `maxRetries`, and its | |
| 5007 | 5015 | default is 0. The `emfileWait` option has been removed, and | |
| 5008 | - `EMFILE` errors use the same retry logic as other errors. | ||
| 5016 | + `EMFILE` errors use the same retry logic as other errors. The | ||
| 5017 | + `retryDelay` option is now supported. | ||
| 5009 | 5018 | - version: v12.10.0 | |
| 5010 | 5019 | pr-url: https://github.com/nodejs/node/pull/29168 | |
| 5011 | 5020 | description: The `recursive`, `maxBusyTries`, and `emfileWait` options are | |
@@ -5018,12 +5027,15 @@ changes: | |||
| 5018 | 5027 | * `options` {Object} | |
| 5019 | 5028 | * `maxRetries` {integer} If an `EBUSY`, `EMFILE`, `ENOTEMPTY`, or `EPERM` | |
| 5020 | 5029 | 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`. | ||
| 5030 | + wait of `retryDelay` ms longer on each try. This option represents the number | ||
| 5031 | + of retries. This option is ignored if the `recursive` option is not `true`. | ||
| 5023 | 5032 | **Default:** `0`. | |
| 5024 | 5033 | * `recursive` {boolean} If `true`, perform a recursive directory removal. In | |
| 5025 | 5034 | recursive mode, errors are not reported if `path` does not exist, and | |
| 5026 | 5035 | operations are retried on failure. **Default:** `false`. | |
| 5036 | + * `retryDelay` {integer} The amount of time in milliseconds to wait between | ||
| 5037 | + retries. This option is ignored if the `recursive` option is not `true`. | ||
| 5038 | + **Default:** `100`. | ||
| 5027 | 5039 | * Returns: {Promise} | |
| 5028 | 5040 | ||
| 5029 | 5041 | Removes the directory identified by `path` then resolves the `Promise` with | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,8 @@ function rimraf(path, options, callback) { | |||
| 35 | 35 | if (err) { | |
| 36 | 36 | if (retryErrorCodes.has(err.code) && retries < options.maxRetries) { | |
| 37 | 37 | retries++; | |
| 38 | - return setTimeout(_rimraf, retries * 100, path, options, CB); | ||
| 38 | + const delay = retries * options.retryDelay; | ||
| 39 | + return setTimeout(_rimraf, delay, path, options, CB); | ||
| 39 | 40 | } | |
| 40 | 41 | ||
| 41 | 42 | // The file is already gone. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,7 @@ const { | |||
| 24 | 24 | const { once } = require('internal/util'); | |
| 25 | 25 | const { toPathIfFileURL } = require('internal/url'); | |
| 26 | 26 | const { | |
| 27 | + validateInt32, | ||
| 27 | 28 | validateUint32 | |
| 28 | 29 | } = require('internal/validators'); | |
| 29 | 30 | const pathModule = require('path'); | |
@@ -562,6 +563,7 @@ function warnOnNonPortableTemplate(template) { | |||
| 562 | 563 | } | |
| 563 | 564 | ||
| 564 | 565 | const defaultRmdirOptions = { | |
| 566 | + retryDelay: 100, | ||
| 565 | 567 | maxRetries: 0, | |
| 566 | 568 | recursive: false, | |
| 567 | 569 | }; | |
@@ -577,6 +579,7 @@ const validateRmdirOptions = hideStackFrames((options) => { | |||
| 577 | 579 | if (typeof options.recursive !== 'boolean') | |
| 578 | 580 | throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', options.recursive); | |
| 579 | 581 | ||
| 582 | + validateInt32(options.retryDelay, 'retryDelay', 0); | ||
| 580 | 583 | validateUint32(options.maxRetries, 'maxRetries'); | |
| 581 | 584 | ||
| 582 | 585 | return options; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,10 +155,12 @@ function removeAsync(dir) { | |||
| 155 | 155 | // Test input validation. | |
| 156 | 156 | { | |
| 157 | 157 | const defaults = { | |
| 158 | + retryDelay: 100, | ||
| 158 | 159 | maxRetries: 0, | |
| 159 | 160 | recursive: false | |
| 160 | 161 | }; | |
| 161 | 162 | const modified = { | |
| 163 | + retryDelay: 953, | ||
| 162 | 164 | maxRetries: 5, | |
| 163 | 165 | recursive: true | |
| 164 | 166 | }; | |
@@ -169,6 +171,7 @@ function removeAsync(dir) { | |||
| 169 | 171 | assert.deepStrictEqual(validateRmdirOptions({ | |
| 170 | 172 | maxRetries: 99 | |
| 171 | 173 | }), { | |
| 174 | + retryDelay: 100, | ||
| 172 | 175 | maxRetries: 99, | |
| 173 | 176 | recursive: false | |
| 174 | 177 | }); | |
@@ -193,6 +196,14 @@ function removeAsync(dir) { | |||
| 193 | 196 | }); | |
| 194 | 197 | }); | |
| 195 | 198 | ||
| 199 | + common.expectsError(() => { | ||
| 200 | + validateRmdirOptions({ retryDelay: -1 }); | ||
| 201 | + }, { | ||
| 202 | + code: 'ERR_OUT_OF_RANGE', | ||
| 203 | + type: RangeError, | ||
| 204 | + message: /^The value of "retryDelay" is out of range\./ | ||
| 205 | + }); | ||
| 206 | + | ||
| 196 | 207 | common.expectsError(() => { | |
| 197 | 208 | validateRmdirOptions({ maxRetries: -1 }); | |
| 198 | 209 | }, { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments