-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
commands cooldowns using load factors #280
base: master
Are you sure you want to change the base?
Conversation
4da9ff5
to
98bf260
Compare
98bf260
to
e87d729
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to specify some commands to ignore/add less load factor (E.G. run inputs that are expected to be spammed) and conversely heavy commands (E.G. that do lots of database operation) would cost more load factor, perhaps as a property of the command itsself. If this ends up adding more complexity than benefit feel free to disregard.
ArgsParser argsParser) | ||
ArgsParser argsParser, | ||
IClock clock, | ||
float maxLoadFactor = 200f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be moved to class constants, E.G. DefaultMaxLoadFactor, ...
this should provide (marginally) easier fine-tuning when the time comes
"command '{Command}' from user {User} ignored because load factor is {LoadFactor} " + | ||
"for timeframe {Duration}, which is above the maximum of {MaxLoadFactor}", | ||
commandName, message.User, loadFactor, _maxLoadFactorTimeframe, _maxLoadFactor); | ||
return new CommandResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return some feedback to the user to let them know they are spamming too hard. I think the natural reaction to your command not being processed is to try again, which may lead to users just digging themselves into a deeper hole and frustrate nonmalicious users.
No description provided.