From 8d145d7a32150da8ed3ec8d1a15f9603e165219d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 4 May 2014 12:28:49 -0700 Subject: [PATCH] Make `threshold` account for job batch sizes smaller than the `throttled` amount. --- test/saucelabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/saucelabs.js b/test/saucelabs.js index a884d0df8..6ee85f640 100644 --- a/test/saucelabs.js +++ b/test/saucelabs.js @@ -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(); }