Skip to content

Commit a88fc9e

Browse files
committed
Configurable parallel jobs
1 parent 2b81eea commit a88fc9e

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 = []
@@ -297,7 +298,9 @@ Runner.prototype = {
297298
// Keep around N most recent build directories.
298299
// Default is 0, ie wipe at start of each run.
299300
// Later, this can be configurable in the UI.
300-
keeper({baseDir: path.join(this.config.dataDir, "data"), count: 0}, function(err) {
301+
keeper({baseDir: path.join(this.config.dataDir, "data"), count: this.config.concurrentJobs - 1}, function(err) {
302+
if (err) throw err;
303+
301304
initJobDirs(self.config.dataDir, job, cache.base, jobDirsReady)
302305
})
303306

@@ -375,4 +378,3 @@ Runner.prototype = {
375378
};
376379
}
377380
};
378-

0 commit comments

Comments
 (0)