throttle current step emit

This commit is contained in:
oleg 2015-05-20 23:49:53 +03:00
parent 52a18c694a
commit dcf029371d

View File

@ -16,6 +16,10 @@ exports.Executor = Executor;
inherits(Executor, EventEmitter);
Executor.prototype.throttledEmit = _(function() {
this.emit.apply(this, arguments);
}).throttle(1500);
Executor.prototype._getSources = function(params, callback) {
};
@ -28,14 +32,14 @@ Executor.prototype.run = function(params, callback) {
project = _({}).extend(self.project, params);
Steppy(
function() {
self.emit('currentStep', 'get sources');
self.throttledEmit('currentStep', 'get sources');
self._getSources(project.scm, this.slot());
},
function(err, scmData) {
self.emit('scmData', scmData);
var funcs = project.steps.map(function(step, index) {
return function() {
self.emit('currentStep', step.name);
self.throttledEmit('currentStep', step.name);
self._runStep(step, this.slot());
};
});