teloxide/crates
Ilya Bizyaev 146d42de37
Fix calculation of per-second used counts in throttling
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.
2024-12-06 23:11:47 +01:00
..
teloxide Merge branch 'master' into fix-stack-overflow 2024-10-21 20:08:23 -04:00
teloxide-core Fix calculation of per-second used counts in throttling 2024-12-06 23:11:47 +01:00
teloxide-macros Add MSRV and deps bumps to the changelogs 2024-08-24 18:46:04 +04:00