Skip to content

Commit

Permalink
Use process.env.PARCEL_MAX_CONCURRENT_CALLS environment variable (#1595)
Browse files Browse the repository at this point in the history
  • Loading branch information
albinotonnina authored and devongovett committed Jul 1, 2018
1 parent 729f252 commit 4808c0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -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).
Expand Down
6 changes: 5 additions & 1 deletion src/workerfarm/WorkerFarm.js
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

0 comments on commit 4808c0c

Please sign in to comment.