mirror of https://github.com/calzoneman/sync.git
Fix #316
This commit is contained in:
parent
c00ce26d57
commit
fb355272fc
14
lib/user.js
14
lib/user.js
|
@ -36,6 +36,7 @@ var User = function (socket) {
|
|||
};
|
||||
this.queueLimiter = $util.newRateLimiter();
|
||||
this.chatLimiter = $util.newRateLimiter();
|
||||
this.rankListLimiter = $util.newRateLimiter();
|
||||
this.profile = {
|
||||
image: "",
|
||||
text: ""
|
||||
|
@ -460,10 +461,19 @@ User.prototype.initCallbacks = function () {
|
|||
|
||||
self.socket.on("requestChannelRanks", function () {
|
||||
if (self.inChannel()) {
|
||||
if (self.noflood("requestChannelRanks", 0.25))
|
||||
return;
|
||||
if (self.rankListLimiter.throttle({
|
||||
burst: 0,
|
||||
sustained: 0.1,
|
||||
cooldown: 10
|
||||
})) {
|
||||
self.socket.emit("noflood", {
|
||||
action: "channel ranks",
|
||||
msg: "You may only refresh channel ranks once every 10 seconds"
|
||||
});
|
||||
} else {
|
||||
self.channel.sendChannelRanks(self);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.socket.on("voteskip", function (data) {
|
||||
|
|
Loading…
Reference in New Issue