Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing terminology for timeouts #210

Open
raid-7 opened this issue Jul 7, 2020 · 0 comments
Open

Confusing terminology for timeouts #210

raid-7 opened this issue Jul 7, 2020 · 0 comments

Comments

@raid-7
Copy link

raid-7 commented Jul 7, 2020

In terms of Telegram bot API the maximum polling time of getUpdates is referred to as timeout. That is if there are pending updates, Telegram will return them immediately. In the other case, it will wait for timeout seconds and then answer with an empty list.

The telegram-bot Rust library has its own notion of timeouts. getUpdates' timeout is dubbed error_delay, whereas the word timeout is used for HTTP request timeout (as parameter for tokio::time::timeout wrapper).

The default value of error_delay is 500ms, which is effectively zero because timeout must be specified in seconds. Telegram documentation discourages zero timeouts. Some bot frameworks I've used default this value to 30 seconds.

Another fact about error_delay is that it has nothing to do with errors. The same value is used in case of successful and faulty previous request.

Apart from that these peculiarities are confusing by nature, the corresponding documentation is incorrect. It claims that timeout corresponds with timeout field in getUpdates and error_delay is a delay between erroneous request and next request.

I suggest bringing implementation in line with documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants