mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Restart tunnel if all jobs have restarted.
This commit is contained in:
@@ -624,6 +624,7 @@ function Tunnel(properties) {
|
|||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
var completed = 0,
|
var completed = 0,
|
||||||
|
restarted = [],
|
||||||
success = true,
|
success = true,
|
||||||
total = all.length,
|
total = all.length,
|
||||||
tunnel = this;
|
tunnel = this;
|
||||||
@@ -641,9 +642,20 @@ function Tunnel(properties) {
|
|||||||
tunnel.dequeue();
|
tunnel.dequeue();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_.invoke(all, 'on', 'restart', function() {
|
||||||
|
if (!_.contains(restarted, this)) {
|
||||||
|
restarted.push(this);
|
||||||
|
}
|
||||||
|
// restart tunnel if all jobs have restarted
|
||||||
|
if (_.isEmpty(_.difference(all, restarted))) {
|
||||||
|
tunnel.restart();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.on('stop', function() {
|
this.on('stop', function() {
|
||||||
completed = 0;
|
completed = 0;
|
||||||
success = true;
|
success = true;
|
||||||
|
restarted.length = 0;
|
||||||
_.invoke(all, 'reset');
|
_.invoke(all, 'reset');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user