mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Avoid rate limiting by Sauce.
This commit is contained in:
@@ -827,13 +827,16 @@ Tunnel.prototype.start = function(callback) {
|
|||||||
* @param {Object} Returns the tunnel instance.
|
* @param {Object} Returns the tunnel instance.
|
||||||
*/
|
*/
|
||||||
Tunnel.prototype.dequeue = function() {
|
Tunnel.prototype.dequeue = function() {
|
||||||
var jobs = this.jobs,
|
var count = 0,
|
||||||
|
jobs = this.jobs,
|
||||||
active = jobs.active,
|
active = jobs.active,
|
||||||
queue = jobs.queue,
|
queue = jobs.queue,
|
||||||
throttled = this.throttled;
|
throttled = this.throttled;
|
||||||
|
|
||||||
while (queue.length && (active.length < 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;
|
return this;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user