From 6ad31a54413da1ff47f87c5a606bc7e9767b1632 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 3 May 2014 22:09:15 -0700 Subject: [PATCH] Restart tunnel if all *active* jobs have restarted. --- test/saucelabs.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/saucelabs.js b/test/saucelabs.js index d08b26b89..a884d0df8 100644 --- a/test/saucelabs.js +++ b/test/saucelabs.js @@ -646,8 +646,9 @@ function Tunnel(properties) { if (!_.contains(restarted, this)) { restarted.push(this); } - // restart tunnel if all jobs have restarted - if (_.isEmpty(_.difference(all, restarted))) { + // restart tunnel if all active jobs have restarted + var threshold = _.isFinite(throttled) ? throttled : 3; + if (active.length >= threshold && _.isEmpty(_.difference(active, restarted))) { tunnel.restart(); } });