From c2e018b2ac8b6983f558ada5e7a5a3dde0fdd747 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 16 Apr 2016 22:49:44 -0700 Subject: [PATCH] Avoid rate limiting by Sauce. --- test/saucelabs.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/saucelabs.js b/test/saucelabs.js index 5d09a51b3..b0e2d26b9 100644 --- a/test/saucelabs.js +++ b/test/saucelabs.js @@ -827,13 +827,16 @@ Tunnel.prototype.start = function(callback) { * @param {Object} Returns the tunnel instance. */ Tunnel.prototype.dequeue = function() { - var jobs = this.jobs, + var count = 0, + jobs = this.jobs, active = jobs.active, queue = jobs.queue, throttled = this.throttled; while (queue.length && (active.length < throttled)) { - active.push(queue.shift().start()); + var job = queue.shift(); + active.push(job); + _.delay(_.bind(job.start, job), ++count * 1000); } return this; };