Skip to content

Added timeout for every method. #110

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

Closed
wants to merge 1 commit into from
Closed

Added timeout for every method. #110

wants to merge 1 commit into from

Conversation

Forden
Copy link
Contributor

@Forden Forden commented Mar 20, 2019

Description

This commit adds timeouts for every API method, that saves your bot from being stuck because of Telegram API unexpected behavior.

Fixes #109 (issue)

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@gabbhack
Copy link
Contributor

Using the default None we leave this task to the user. I think we should come up with an adequate timeout by default.

@JrooTJunior
Copy link
Member

Why timeout argument was added only for methods in Bot class? What about shorted API methods (message.reply and etc.)?

@JrooTJunior
Copy link
Member

I think about setting timeout by the context manager instead of passing as argument it to the all of API methods.

Example:

with bot.request_timeout(3):
    message.reply(...)

It can be implemented with using the contextvars.

What do you think about that?

@JrooTJunior JrooTJunior added question issue It's not really an issue, but a question and removed question issue It's not really an issue, but a question labels Apr 8, 2019
@JrooTJunior
Copy link
Member

I will cancel that issue and start to implement different method of using timeouts.

@JrooTJunior JrooTJunior closed this Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding timeout for Bot API methods.
3 participants