diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8aae38d7ac1..8152dd6e955 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,6 +61,8 @@ You can set `PARCEL_WORKERS` to the number of worker processes to spawn. **NOTE:** When developing plugins or new Asset types, run with `--no-cache` (or pass `cache: false` to `Bundler` options). Parcel uses caching by default, but during development you'll normally pass incomplete results into the cache. This can leave you wondering why you're constantly seeing old results. +You can set `PARCEL_MAX_CONCURRENT_CALLS` to change the limit of concurrent calls per worker. + ## Link to local parcel build While contributing to parcel, you may need to run a local version of parcel and set it as the global cli option in your command line, so that when you run `parcel ...`, it will find your new local variant of parcel instead of the global package installed before (if you had it installed globally before). diff --git a/src/workerfarm/WorkerFarm.js b/src/workerfarm/WorkerFarm.js index a8614e0afb1..e2e7758dbeb 100644 --- a/src/workerfarm/WorkerFarm.js +++ b/src/workerfarm/WorkerFarm.js @@ -10,7 +10,7 @@ class WorkerFarm extends EventEmitter { this.options = Object.assign( { maxConcurrentWorkers: WorkerFarm.getNumWorkers(), - maxConcurrentCallsPerWorker: 10, + maxConcurrentCallsPerWorker: WorkerFarm.getConcurrentCallsPerWorker(), forcedKillTime: 100, warmWorkers: true, useLocalWorker: true, @@ -276,6 +276,10 @@ class WorkerFarm extends EventEmitter { } return cores || 1; } + + static getConcurrentCallsPerWorker() { + return parseInt(process.env.PARCEL_MAX_CONCURRENT_CALLS) || 10; + } } module.exports = WorkerFarm;