Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 64db490

Browse files
committedAug 31, 2018
fix(workers): disable workers for now
1 parent e81484c commit 64db490

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed
 

‎index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const CipmOpts = figgyPudding({
2525
also: {},
2626
dev: 'development',
2727
development: {},
28+
dirPacker: {},
2829
force: {},
2930
global: {},
3031
ignoreScripts: 'ignore-scripts',
@@ -238,7 +239,7 @@ class Installer {
238239
return next()
239240
} else {
240241
return BB.resolve(extract.child(
241-
dep.name, dep, depPath, this.config, this.opts
242+
dep.name, dep, depPath, this.opts
242243
))
243244
.then(() => cg.completeWork(1))
244245
.then(() => { this.pkgCount++ })

‎lib/extract.js

+31-20
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,56 @@
22

33
const BB = require('bluebird')
44

5-
const npa = require('npm-package-arg')
6-
const workerFarm = require('worker-farm')
7-
85
const extractionWorker = require('./worker.js')
6+
const figgyPudding = require('figgy-pudding')
7+
const npa = require('npm-package-arg')
98
const WORKER_PATH = require.resolve('./worker.js')
9+
let workerFarm
10+
11+
// Broken for now, cause too many issues on some systems.
12+
const ENABLE_WORKERS = false
13+
14+
const ExtractOpts = figgyPudding({
15+
log: {}
16+
})
1017

1118
module.exports = {
1219
startWorkers () {
13-
this._workers = workerFarm({
14-
maxConcurrentCallsPerWorker: 20,
15-
maxRetries: 1
16-
}, WORKER_PATH)
20+
if (ENABLE_WORKERS) {
21+
if (!workerFarm) { workerFarm = require('worker-farm') }
22+
this._workers = workerFarm({
23+
maxConcurrentCallsPerWorker: 20,
24+
maxRetries: 1
25+
}, WORKER_PATH)
26+
}
1727
},
1828

1929
stopWorkers () {
20-
workerFarm.end(this._workers)
30+
if (ENABLE_WORKERS) {
31+
if (!workerFarm) { workerFarm = require('worker-farm') }
32+
workerFarm.end(this._workers)
33+
}
2134
},
2235

23-
child (name, child, childPath, config, opts) {
36+
child (name, child, childPath, opts) {
37+
opts = ExtractOpts(opts)
2438
const spec = npa.resolve(name, child.version)
25-
const additionalToPacoteOpts = {}
26-
if (typeof opts.dirPacker !== 'undefined') {
27-
additionalToPacoteOpts.dirPacker = opts.dirPacker
28-
}
29-
const childOpts = config.toPacote(Object.assign({
39+
let childOpts = opts.concat({
3040
integrity: child.integrity,
3141
resolved: child.resolved
32-
}, additionalToPacoteOpts))
42+
})
3343
const args = [spec, childPath, childOpts]
3444
return BB.fromNode((cb) => {
3545
let launcher = extractionWorker
3646
let msg = args
3747
const spec = typeof args[0] === 'string' ? npa(args[0]) : args[0]
38-
childOpts.loglevel = opts.log.level
39-
if (spec.registry || spec.type === 'remote') {
48+
if (ENABLE_WORKERS && (spec.registry || spec.type === 'remote')) {
49+
if (!workerFarm) { workerFarm = require('worker-farm') }
4050
// We can't serialize these options
41-
childOpts.config = null
42-
childOpts.log = null
43-
childOpts.dirPacker = null
51+
childOpts = childOpts.concat({
52+
log: null,
53+
dirPacker: null
54+
})
4455
// workers will run things in parallel!
4556
launcher = this._workers
4657
try {

0 commit comments

Comments
 (0)
This repository has been archived.