Throttle comma-separated lists properly

This commit is contained in:
calzoneman 2013-10-01 13:14:44 -05:00
parent 54dee9e25d
commit 29a1f0b9d3

View file

@ -1348,10 +1348,19 @@ Channel.prototype.tryQueue = function(user, data) {
if (this.playlist.items.length === 0)
data.list.unshift(data.list.pop());
}
for (var i = 0; i < data.list.length; i++) {
data.list[i].pos = data.pos;
this.tryQueue(user, data.list[i]);
}
var i = 0;
var self = this;
var next = function () {
if (self.dead)
return;
if (i < data.list.length) {
data.list[i].pos = data.pos;
self.tryQueue(user, data.list[i]);
i++;
setTimeout(next, 2000);
}
};
next();
} else {
this.addMedia(data, user);
}