mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-11-17 23:50:11 -05:00
rate limiting for message sending
This commit is contained in:
parent
0a1260b03a
commit
780548b577
4 changed files with 7 additions and 4 deletions
|
|
@ -35,12 +35,12 @@ class BaseHandler(object):
|
|||
allowed, time_allowed = self.ratelimiter.send_message(
|
||||
user_id, time_now,
|
||||
msg_rate_hz=self.hs.config.rc_messages_per_second,
|
||||
burst_count=self.hs.config.rc_messsage_burst_count,
|
||||
burst_count=self.hs.config.rc_message_burst_count,
|
||||
)
|
||||
if not allowed:
|
||||
raise cs_error(
|
||||
"Limit exceeded",
|
||||
Codes.M_LIMIT_EXCEEDED,
|
||||
Codes.LIMIT_EXCEEDED,
|
||||
retry_after_ms=1000*(time_allowed - time_now),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue