Lonami / grammers

(tele)gramme.rs - use Telegram's API from Rust

Home Page:https://t.me/gramme_rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`flood_sleep_threshold` unused?

mkpankov opened this issue · comments

I'm seeing RpcError { name: "FLOOD_WAIT", value: Some(17) }. I have flood_sleep_threshold: Some(60), in my params.
I've cloned entire grammers repo and only 3 mentions of this field are found
image
none of which actually read that value or pass it down.

Am I missing something or this field is a stub for the future?

This field is a stub for the future.

Ok, thanks for explanation

We can keep this open to track its implementation.

If you (or someone else) is interested in implementing this, it should be as simple as modifying the invoke method:

pub async fn invoke<R: tl::RemoteCall>(

to detect this error and sleep automatically before retrying. Telethon is slightly more advanced and keeps a cache of "floodwaited requests" to avoid sending them entirely if we know they would floodwait, but for an initial implementation, it is not necessary.

I saw some implementation in git history. Why it was removed?

Might have been removed unintentionally on accident, or intentionally temporarily during refactoring. I can't really remember. But the idea definitely is for it to be implemented.

This was implemented in #130.