Make threshold account for job batch sizes smaller than the throttled amount.

This commit is contained in:
John-David Dalton
2014-05-04 12:28:49 -07:00
parent 4a0419e554
commit 8d145d7a32

View File

@@ -647,7 +647,7 @@ function Tunnel(properties) {
restarted.push(this);
}
// restart tunnel if all active jobs have restarted
var threshold = _.isFinite(throttled) ? throttled : 3;
var threshold = Math.min(all.length, _.isFinite(throttled) ? throttled : 3);
if (active.length >= threshold && _.isEmpty(_.difference(active, restarted))) {
tunnel.restart();
}