8000 Set maxParallelFileOps to 1000 by lukastaegert · Pull Request #5992 · rollup/rollup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Set maxParallelFileOps to 1000 #5992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/configuration-options/index.md
10000
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ Note that when a relative path is directly marked as "external" using the [`exte
| -------: | :------------------------------ |
| Type: | `number` |
| CLI: | `--maxParallelFileOps <number>` |
| Default: | `Infinity` |
| Default: | 1000 |

Limits the number of files rollup will open in parallel when reading modules or writing chunks. Without a limit or with a high enough value, builds can fail with an "EMFILE: too many open files". This depends on how many open file handles the operating system allows. If you set the limit too low and use plugins that rely on the [`this.load`](../plugin-development/index.md#this-load) context function, such as the `commonjs` plugin, then it can happen that builds stall without an error message as it limits the number of parallel `load` calls.

Expand Down
7 changes: 5 additions & 2 deletions src/utils/options/normalizeInputOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,11 @@ const getMaxParallelFileOps = (
config: InputOptions
): NormalizedInputOptions['maxParallelFileOps'] => {
const maxParallelFileOps = config.maxParallelFileOps;
if (typeof maxParallelFileOps !== 'number' || maxParallelFileOps <= 0) return Infinity;
return maxParallelFileOps;
if (typeof maxParallelFileOps === 'number') {
if (maxParallelFileOps <= 0) return Infinity;
return maxParallelFileOps;
}
return 1000;
};

const getModuleContext = (
Expand Down
4 changes: 2 additions & 2 deletions test/function/samples/options-hook/_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ module.exports = defineTest({
name: 'test-plugin',
buildStart(options) {
// The fs option is not json stringifiable
const { fs, maxParallelFileOps, ...restOptions } = options;
const { fs, ...restOptions } = options;
assert.ok(fs);
assert.strictEqual(maxParallelFileOps, Infinity);
assert.deepStrictEqual(JSON.parse(JSON.stringify(restOptions)), {
context: 'undefined',
experimentalCacheExpiry: 10,
Expand All @@ -22,6 +21,7 @@ module.exports = defineTest({
jsx: false,
logLevel: 'info',
makeAbsoluteExternalsRelative: 'ifRelativeSource',
maxParallelFileOps: 1000,
perf: false,
plugins: [
{
Expand Down
Loading
0