summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-11-25 15:04:18 -0500
committercjihrig <cjihrig@gmail.com>2019-11-27 18:27:11 -0500
commit4059055739c1c395c00cf989d77073e862f9dae6 (patch)
tree218dbe11b5f0931b09b14ce5284e579d8512fe7b
parent84aa19270d2d2736f1e18b359e3531b76db788d3 (diff)
downloadandroid-node-v8-4059055739c1c395c00cf989d77073e862f9dae6.tar.gz
android-node-v8-4059055739c1c395c00cf989d77073e862f9dae6.tar.bz2
android-node-v8-4059055739c1c395c00cf989d77073e862f9dae6.zip
fs: rename rimraf's maxBusyTries to maxRetries
This is part of reworking the rimraf retry logic. Refs: https://github.com/nodejs/node/issues/30580 PR-URL: https://github.com/nodejs/node/pull/30644 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--doc/api/fs.md13
-rw-r--r--lib/internal/fs/rimraf.js2
-rw-r--r--lib/internal/fs/utils.js4
-rw-r--r--test/parallel/test-fs-rmdir-recursive.js12
4 files changed, 20 insertions, 11 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index de0acff8ea..b96f635c1a 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -3220,6 +3220,9 @@ Synchronous rename(2). Returns `undefined`.
<!-- YAML
added: v0.0.2
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/30644
+ description: The `maxBusyTries` option is renamed to `maxRetries`.
- version: v12.10.0
pr-url: https://github.com/nodejs/node/pull/29168
description: The `recursive`, `maxBusyTries`, and `emfileWait` options are
@@ -3246,7 +3249,7 @@ changes:
retry the operation with a linear backoff of 1ms longer on each try until the
timeout duration passes this limit. This option is ignored if the `recursive`
option is not `true`. **Default:** `1000`.
- * `maxBusyTries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
+ * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
encountered, Node.js will retry the operation with a linear backoff wait of
100ms longer on each try. This option represents the number of retries. This
option is ignored if the `recursive` option is not `true`. **Default:** `3`.
@@ -3266,6 +3269,9 @@ Windows and an `ENOTDIR` error on POSIX.
<!-- YAML
added: v0.1.21
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/30644
+ description: The `maxBusyTries` option is renamed to `maxRetries`.
- version: v12.10.0
pr-url: https://github.com/nodejs/node/pull/29168
description: The `recursive`, `maxBusyTries`, and `emfileWait` options are
@@ -4990,6 +4996,9 @@ upon success.
<!-- YAML
added: v10.0.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/30644
+ description: The `maxBusyTries` option is renamed to `maxRetries`.
- version: v12.10.0
pr-url: https://github.com/nodejs/node/pull/29168
description: The `recursive`, `maxBusyTries`, and `emfileWait` options are
@@ -5004,7 +5013,7 @@ changes:
retry the operation with a linear backoff of 1ms longer on each try until the
timeout duration passes this limit. This option is ignored if the `recursive`
option is not `true`. **Default:** `1000`.
- * `maxBusyTries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
+ * `maxRetries` {integer} If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error is
encountered, Node.js will retry the operation with a linear backoff wait of
100ms longer on each try. This option represents the number of retries. This
option is ignored if the `recursive` option is not `true`. **Default:** `3`.
diff --git a/lib/internal/fs/rimraf.js b/lib/internal/fs/rimraf.js
index 73f783d1d2..c9f3b3e01d 100644
--- a/lib/internal/fs/rimraf.js
+++ b/lib/internal/fs/rimraf.js
@@ -35,7 +35,7 @@ function rimraf(path, options, callback) {
_rimraf(path, options, function CB(err) {
if (err) {
if ((err.code === 'EBUSY' || err.code === 'ENOTEMPTY' ||
- err.code === 'EPERM') && busyTries < options.maxBusyTries) {
+ err.code === 'EPERM') && busyTries < options.maxRetries) {
busyTries++;
return setTimeout(_rimraf, busyTries * 100, path, options, CB);
}
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
index 2aaf267987..660c81f454 100644
--- a/lib/internal/fs/utils.js
+++ b/lib/internal/fs/utils.js
@@ -567,7 +567,7 @@ function warnOnNonPortableTemplate(template) {
const defaultRmdirOptions = {
emfileWait: 1000,
- maxBusyTries: 3,
+ maxRetries: 3,
recursive: false,
};
@@ -583,7 +583,7 @@ const validateRmdirOptions = hideStackFrames((options) => {
throw new ERR_INVALID_ARG_TYPE('recursive', 'boolean', options.recursive);
validateInt32(options.emfileWait, 'emfileWait', 0);
- validateUint32(options.maxBusyTries, 'maxBusyTries');
+ validateUint32(options.maxRetries, 'maxRetries');
return options;
});
diff --git a/test/parallel/test-fs-rmdir-recursive.js b/test/parallel/test-fs-rmdir-recursive.js
index 5f630b686a..6bc7fc6e56 100644
--- a/test/parallel/test-fs-rmdir-recursive.js
+++ b/test/parallel/test-fs-rmdir-recursive.js
@@ -156,12 +156,12 @@ function removeAsync(dir) {
{
const defaults = {
emfileWait: 1000,
- maxBusyTries: 3,
+ maxRetries: 3,
recursive: false
};
const modified = {
emfileWait: 953,
- maxBusyTries: 5,
+ maxRetries: 5,
recursive: true
};
@@ -169,10 +169,10 @@ function removeAsync(dir) {
assert.deepStrictEqual(validateRmdirOptions({}), defaults);
assert.deepStrictEqual(validateRmdirOptions(modified), modified);
assert.deepStrictEqual(validateRmdirOptions({
- maxBusyTries: 99
+ maxRetries: 99
}), {
emfileWait: 1000,
- maxBusyTries: 99,
+ maxRetries: 99,
recursive: false
});
@@ -205,10 +205,10 @@ function removeAsync(dir) {
});
common.expectsError(() => {
- validateRmdirOptions({ maxBusyTries: -1 });
+ validateRmdirOptions({ maxRetries: -1 });
}, {
code: 'ERR_OUT_OF_RANGE',
type: RangeError,
- message: /^The value of "maxBusyTries" is out of range\./
+ message: /^The value of "maxRetries" is out of range\./
});
}