mirror of https://github.com/calzoneman/sync.git
Fix #316
This commit is contained in:
parent
c00ce26d57
commit
fb355272fc
16
lib/user.js
16
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,9 +461,18 @@ User.prototype.initCallbacks = function () {
|
|||
|
||||
self.socket.on("requestChannelRanks", function () {
|
||||
if (self.inChannel()) {
|
||||
if (self.noflood("requestChannelRanks", 0.25))
|
||||
return;
|
||||
self.channel.sendChannelRanks(self);
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue