Browse Source

Tighten Telegram rate limit to 6 messages / minute

With the previous 10 minutes / minute limit we were still hitting
Telegram API rate limit (the 429, "Too Many Requests" response)
from time to time.

Therefore, tighten the limit a bit on our side.
pull/468/head
Pēteris Caune 4 years ago
parent
commit
ee37d305ef
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      hc/api/models.py

+ 2
- 2
hc/api/models.py View File

@ -899,8 +899,8 @@ class TokenBucket(models.Model):
def authorize_telegram(telegram_id): def authorize_telegram(telegram_id):
value = "tg-%s" % telegram_id value = "tg-%s" % telegram_id
# 10 messages for a single chat per minute:
return TokenBucket.authorize(value, 10, 60)
# 6 messages for a single chat per minute:
return TokenBucket.authorize(value, 6, 60)
@staticmethod @staticmethod
def authorize_sudo_code(user): def authorize_sudo_code(user):


Loading…
Cancel
Save