mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-10 21:35:07 +00:00
create distributor node after plugins load
This commit is contained in:
parent
4304cd009e
commit
1bf07741ab
4
app.js
4
app.js
@ -230,7 +230,7 @@ Steppy(
|
||||
completeUncompletedBuilds(this.slot());
|
||||
},
|
||||
function() {
|
||||
require('./distributor').init(app, this.slot());
|
||||
require('./distributor').create(app, this.slot());
|
||||
},
|
||||
function(err, distributor) {
|
||||
app.builds = new BuildsCollection({
|
||||
@ -244,6 +244,8 @@ Steppy(
|
||||
require(plugin).register(app);
|
||||
});
|
||||
|
||||
distributor.init();
|
||||
|
||||
app.notifier.init(app.config.notify, this.slot());
|
||||
},
|
||||
function() {
|
||||
|
@ -7,7 +7,7 @@ var Steppy = require('twostep').Steppy,
|
||||
logger = require('./lib/logger')('distributor');
|
||||
|
||||
|
||||
exports.init = function(app, callback) {
|
||||
exports.create = function(app, callback) {
|
||||
var distributor = new Distributor({
|
||||
nodes: app.config.nodes,
|
||||
projects: app.projects,
|
||||
|
@ -9,33 +9,39 @@ var Steppy = require('twostep').Steppy,
|
||||
|
||||
|
||||
function Distributor(params) {
|
||||
var self = this;
|
||||
// nodes to execute builds
|
||||
self.nodes = _(params.nodes).map(function(nodeParams) {
|
||||
return self._createNode(nodeParams);
|
||||
});
|
||||
// queued projects to build
|
||||
self.queue = [];
|
||||
this.nodes = params.nodes;
|
||||
|
||||
self.saveBuild = params.saveBuild || function(build, callback) {
|
||||
// queued projects to build
|
||||
this.queue = [];
|
||||
|
||||
this.saveBuild = params.saveBuild || function(build, callback) {
|
||||
callback(null, build);
|
||||
};
|
||||
|
||||
self.removeBuild = params.removeBuild || function(build, callback) {
|
||||
this.removeBuild = params.removeBuild || function(build, callback) {
|
||||
callback();
|
||||
};
|
||||
|
||||
self.projects = params.projects;
|
||||
self.notifier = params.notifier;
|
||||
this.projects = params.projects;
|
||||
this.notifier = params.notifier;
|
||||
|
||||
self.buildLogLineNumbersHash = {},
|
||||
self.lastLinesHash = {};
|
||||
this.buildLogLineNumbersHash = {},
|
||||
this.lastLinesHash = {};
|
||||
}
|
||||
|
||||
inherits(Distributor, EventEmitter);
|
||||
|
||||
exports.Distributor = Distributor;
|
||||
|
||||
// do deferred initialization (e.g. create nodes after all plugins load)
|
||||
Distributor.prototype.init = function() {
|
||||
var self = this;
|
||||
// nodes to execute builds
|
||||
self.nodes = _(self.nodes).map(function(nodeParams) {
|
||||
return self._createNode(nodeParams);
|
||||
});
|
||||
};
|
||||
|
||||
Distributor.prototype._createNode = function(params) {
|
||||
return createNode(params);
|
||||
};
|
||||
|
@ -52,6 +52,7 @@ exports.createDistributor = function(params) {
|
||||
});
|
||||
|
||||
var distributor = new Distributor(distributorParams);
|
||||
distributor.init();
|
||||
|
||||
if (mockNode) {
|
||||
Distributor.prototype._createNode.restore();
|
||||
|
Loading…
Reference in New Issue
Block a user