Skip to content

Commit dfb86f9

Browse files
cjihrigtargos
authored andcommitted
fs: rename rimraf's maxBusyTries to maxRetries
This is part of reworking the rimraf retry logic. Refs: #30580 PR-URL: #30644 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c8e30c1 commit dfb86f9

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

doc/api/fs.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -3220,6 +3220,9 @@ Synchronous rename(2). Returns `undefined`.
32203220
<!-- YAML
32213221
added: v0.0.2
32223222
changes:
3223+
- version: REPLACEME
3224+
pr-url: https://github.com/nodejs/node/pull/30644
3225+
description: The `maxBusyTries` option is renamed to `maxRetries`.
32233226
- version: v12.10.0
32243227
pr-url: https://github.com/nodejs/node/pull/29168
32253228
description: The `recursive`, `maxBusyTries`, and `emfileWait` options are
@@ -3246,7 +3249,7 @@ changes:
32463249
retry the operation with a linear backoff of 1ms longer on each try until the
32473250
timeout duration passes this limit. This option is ignored if the `recursive`
32483251
option is not `true`. **Default:** `1000`.
3249-
* `maxBusyTries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
3252+
* `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
32503253
encountered, Node.js will retry the operation with a linear backoff wait of
32513254
100ms longer on each try. This option represents the number of retries. This
32523255
option is ignored if the `recursive` option is not `true`. **Default:** `3`.
@@ -3266,6 +3269,9 @@ Windows and an `ENOTDIR` error on POSIX.
32663269
<!-- YAML
32673270
added: v0.1.21
32683271
changes:
3272+
- version: REPLACEME
3273+
pr-url: https://github.com/nodejs/node/pull/30644
3274+
description: The `maxBusyTries` option is renamed to `maxRetries`.
32693275
- version: v12.10.0
32703276
pr-url: https://github.com/nodejs/node/pull/29168
32713277
description: The `recursive`, `maxBusyTries`, and `emfileWait` options are
@@ -4990,6 +4996,9 @@ upon success.
49904996
<!-- YAML
49914997
added: v10.0.0
49924998
changes:
4999+
- version: REPLACEME
5000+
pr-url: https://github.com/nodejs/node/pull/30644
5001+
description: The `maxBusyTries` option is renamed to `maxRetries`.
49935002
- version: v12.10.0
49945003
pr-url: https://github.com/nodejs/node/pull/29168
49955004
description: The `recursive`, `maxBusyTries`, and `emfileWait` options are
@@ -5004,7 +5013,7 @@ changes:
50045013
retry the operation with a linear backoff of 1ms longer on each try until the
50055014
timeout duration passes this limit. This option is ignored if the `recursive`
50065015
option is not `true`. **Default:** `1000`.
5007-
* `maxBusyTries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
5016+
* `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
50085017
encountered, Node.js will retry the operation with a linear backoff wait of
50095018
100ms longer on each try. This option represents the number of retries. This
50105019
option is ignored if the `recursive` option is not `true`. **Default:** `3`.

lib/internal/fs/rimraf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function rimraf(path, options, callback) {
3535
_rimraf(path, options, function CB(err) {
3636
if (err) {
3737
if ((err.code === 'EBUSY' || err.code === 'ENOTEMPTY' ||
38-
err.code === 'EPERM') && busyTries < options.maxBusyTries) {
38+
err.code === 'EPERM') && busyTries < options.maxRetries) {
3939
busyTries++;
4040
return setTimeout(_rimraf, busyTries * 100, path, options, CB);
4141
}

lib/internal/fs/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ function warnOnNonPortableTemplate(template) {
564564

565565
const defaultRmdirOptions = {
566566
emfileWait: 1000,
567-
maxBusyTries: 3,
567+
maxRetries: 3,
568568
recursive: false,
569569
};
570570

@@ -580,7 +580,7 @@ const validateRmdirOptions = hideStackFrames((options) => {
580580
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', options.recursive);
581581

582582
validateInt32(options.emfileWait, 'emfileWait', 0);
583-
validateUint32(options.maxBusyTries, 'maxBusyTries');
583+
validateUint32(options.maxRetries, 'maxRetries');
584584

585585
return options;
586586
});

test/parallel/test-fs-rmdir-recursive.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,23 @@ function removeAsync(dir) {
156156
{
157157
const defaults = {
158158
emfileWait: 1000,
159-
maxBusyTries: 3,
159+
maxRetries: 3,
160160
recursive: false
161161
};
162162
const modified = {
163163
emfileWait: 953,
164-
maxBusyTries: 5,
164+
maxRetries: 5,
165165
recursive: true
166166
};
167167

168168
assert.deepStrictEqual(validateRmdirOptions(), defaults);
169169
assert.deepStrictEqual(validateRmdirOptions({}), defaults);
170170
assert.deepStrictEqual(validateRmdirOptions(modified), modified);
171171
assert.deepStrictEqual(validateRmdirOptions({
172-
maxBusyTries: 99
172+
maxRetries: 99
173173
}), {
174174
emfileWait: 1000,
175-
maxBusyTries: 99,
175+
maxRetries: 99,
176176
recursive: false
177177
});
178178

@@ -205,10 +205,10 @@ function removeAsync(dir) {
205205
});
206206

207207
common.expectsError(() => {
208-
validateRmdirOptions({ maxBusyTries: -1 });
208+
validateRmdirOptions({ maxRetries: -1 });
209209
}, {
210210
code: 'ERR_OUT_OF_RANGE',
211211
type: RangeError,
212-
message: /^The value of "maxBusyTries" is out of range\./
212+
message: /^The value of "maxRetries" is out of range\./
213213
});
214214
}

0 commit comments

Comments
 (0)