Fixed bug where updates on sliders weren't debounced
This commit is contained in:
16
app/server/lib/configuration/globalRateLimit.js
Normal file
16
app/server/lib/configuration/globalRateLimit.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const logRateLimit = _.debounce(function (ruleInput) {
|
||||
console.log(`Rate limit on ${ruleInput.name} by user ${ruleInput.userId} at IP ${ruleInput.clientAddress}`);
|
||||
}, 500);
|
||||
|
||||
DDPRateLimiter.addRule({
|
||||
type: 'method',
|
||||
name(name) {
|
||||
return true;
|
||||
},
|
||||
// Rate limit per connection ID
|
||||
connectionId() { return true; }
|
||||
}, 10, 1000, (reply, ruleInput) => {
|
||||
if (!reply.allowed) {
|
||||
logRateLimit(ruleInput);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user