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) if (this.playlist.items.length === 0)
data.list.unshift(data.list.pop()); data.list.unshift(data.list.pop());
} }
for (var i = 0; i < data.list.length; i++) { var i = 0;
data.list[i].pos = data.pos; var self = this;
this.tryQueue(user, data.list[i]); 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 { } else {
this.addMedia(data, user); this.addMedia(data, user);
} }