diff --git a/lib/executor/base.js b/lib/executor/base.js index 65c821a..c4cff73 100644 --- a/lib/executor/base.js +++ b/lib/executor/base.js @@ -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()); }; });