mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
implement FAIL METADATA RATE_LIMITED
This commit is contained in:
parent
96aa018352
commit
0119bbc36f
8 changed files with 52 additions and 7 deletions
|
|
@ -3197,6 +3197,18 @@ func metadataRegisteredHandler(client *Client, config *Config, subcommand string
|
|||
return
|
||||
}
|
||||
|
||||
// only rate limit clients changing their own metadata:
|
||||
// channel metadata updates are not any more costly than a PRIVMSG
|
||||
if client == targetClient {
|
||||
if throttled, remainingTime := client.checkMetadataThrottle(); throttled {
|
||||
retryAfter := strconv.Itoa(int(remainingTime.Seconds()) + 1)
|
||||
rb.Add(nil, server.name, "FAIL", "METADATA", "RATE_LIMITED",
|
||||
target, utils.SafeErrorParam(key), retryAfter,
|
||||
fmt.Sprintf(client.t("Please wait at least %v and try again"), remainingTime.Round(time.Millisecond)))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if len(params) > 3 {
|
||||
value := params[3]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue