mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-02-04 11:50:15 +00:00
throttle current step emit
This commit is contained in:
parent
52a18c694a
commit
dcf029371d
@ -16,6 +16,10 @@ exports.Executor = Executor;
|
|||||||
|
|
||||||
inherits(Executor, EventEmitter);
|
inherits(Executor, EventEmitter);
|
||||||
|
|
||||||
|
Executor.prototype.throttledEmit = _(function() {
|
||||||
|
this.emit.apply(this, arguments);
|
||||||
|
}).throttle(1500);
|
||||||
|
|
||||||
Executor.prototype._getSources = function(params, callback) {
|
Executor.prototype._getSources = function(params, callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -28,14 +32,14 @@ Executor.prototype.run = function(params, callback) {
|
|||||||
project = _({}).extend(self.project, params);
|
project = _({}).extend(self.project, params);
|
||||||
Steppy(
|
Steppy(
|
||||||
function() {
|
function() {
|
||||||
self.emit('currentStep', 'get sources');
|
self.throttledEmit('currentStep', 'get sources');
|
||||||
self._getSources(project.scm, this.slot());
|
self._getSources(project.scm, this.slot());
|
||||||
},
|
},
|
||||||
function(err, scmData) {
|
function(err, scmData) {
|
||||||
self.emit('scmData', scmData);
|
self.emit('scmData', scmData);
|
||||||
var funcs = project.steps.map(function(step, index) {
|
var funcs = project.steps.map(function(step, index) {
|
||||||
return function() {
|
return function() {
|
||||||
self.emit('currentStep', step.name);
|
self.throttledEmit('currentStep', step.name);
|
||||||
self._runStep(step, this.slot());
|
self._runStep(step, this.slot());
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user