mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
146d42de37
This is not the cause of throttling issues that I was having, but something I think is a bug from reading the code. `history` is a deque that is kept sorted by the timestamp: old entries are popped from the front, and new entries are pushed to the back. To calculate `used` and `requests_sent.per_sec[chat]`, we want to count entries from the past second, so the newest ones, so from the back. For `take_while` to work as expected, it needs to be called on the reverse iterator, as the regular iterator is front-to-back. Otherwise `take_while` can finish early due to entries that are up to a minute old. |
||
---|---|---|
.. | ||
teloxide | ||
teloxide-core | ||
teloxide-macros |