teloxide/crates/teloxide-core
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
..
examples Merge rustfmt.tomls 2022-11-07 16:13:29 +04:00
src Fix calculation of per-second used counts in throttling 2024-12-06 23:11:47 +01:00
Cargo.toml Add dedicated Rgb struct to replace [u8; 3] 2024-08-28 21:27:51 +04:00
CHANGELOG.md Update the teloxide-core changelog 2024-10-05 18:15:42 -04:00
LICENSE link licenses 2022-11-07 16:49:58 +04:00
README.md Bump MSRV to 1.80 2024-08-24 18:16:56 +04:00
schema.ron Add dedicated Rgb struct to replace [u8; 3] 2024-08-28 21:27:51 +04:00

teloxide-core

The core part of teloxide providing tools for making requests to the Telegram Bot API with ease. This library is fully asynchronous and built using tokio.

teloxide-core = "0.10.1"

Compiler support: requires rustc 1.80+.