Skip to content

Commit

Permalink
Add --maxWorkers switch
Browse files Browse the repository at this point in the history
In fixing npm#19170, rvagg/node-worker-farm#65 falls back to basically
disabling multiple workers, so the user may want a switch to override.
  • Loading branch information
Quasic committed Nov 16, 2017
1 parent fb28e58 commit dc41c8a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/install/action/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ const ENABLE_WORKERS = process.platform === 'darwin'

extract.init = () => {
if (ENABLE_WORKERS) {
workers = workerFarm({
var workerOptions={
maxConcurrentCallsPerWorker: npm.limit.fetch,
maxRetries: 1
}, WORKER_PATH)
}
var maxWorkers=parseInt(npm.config.get("maxWorkers"))
if (maxWorkers) {
workerOptions.maxConcurrentWorkers = maxWorkers
}
workers = workerFarm(workerOptions, WORKER_PATH)
}
return BB.resolve()
}
Expand Down

0 comments on commit dc41c8a

Please sign in to comment.