Skip to content

Commit 9d64e22

Browse files
committed
Configurable parallel jobs
1 parent cc5a8bd commit 9d64e22

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ function Runner(emitter, config) {
5656
logger: console,
5757
processJob: core.process,
5858
pluginDir: path.join(__dirname, '../node_modules'),
59-
dataDir: process.env.STRIDER_CLONE_DEST || dotStrider
59+
dataDir: process.env.STRIDER_CLONE_DEST || dotStrider,
60+
concurrentJobs: parseInt(process.env.CONCURRENT_JOBS || '1', 10) || 1,
6061
}, config)
6162
this.emitter = emitter
6263
this.log = this.config.logger.log
63-
this.queue = async.queue(this.processJob.bind(this), 1)
64+
this.queue = async.queue(this.processJob.bind(this), this.config.concurrentJobs)
6465
this.io = this.config.io
6566
this.callbackMap = {}
6667
this.hooks = []
@@ -295,7 +296,9 @@ Runner.prototype = {
295296
// Keep around N most recent build directories.
296297
// Default is 0, ie wipe at start of each run.
297298
// Later, this can be configurable in the UI.
298-
keeper({baseDir: path.join(this.config.dataDir, "data"), count: 0}, function(err) {
299+
keeper({baseDir: path.join(this.config.dataDir, "data"), count: this.config.concurrentJobs - 1}, function(err) {
300+
if (err) throw err;
301+
299302
initJobDirs(self.config.dataDir, job, cache.base, jobDirsReady)
300303
})
301304

@@ -373,4 +376,3 @@ Runner.prototype = {
373376
};
374377
}
375378
};
376-

0 commit comments

Comments
 (0)