-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
updater.py: Better handling of timeouts during getUpdates #1007
Conversation
TimedOut exception is an expected an normal event. To reduce noise and make things more "fluent" we now: - Make sure that we don't sleep after the timeout but rather retry immediately. - Log debug instead of error level. Fixes #802
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally it looks good. But I'm wondering. This will probably work fine for a shortly interrupted connection, but won't this hog memory when timedout is fired often?
telegram/ext/updater.py
Outdated
@@ -288,8 +286,12 @@ def _start_polling(self, poll_interval, timeout, read_latency, bootstrap_retries | |||
except RetryAfter as e: | |||
self.logger.info(str(e)) | |||
cur_interval = 0.5 + e.retry_after | |||
except TimedOut as toe: | |||
self.logger.debug('Timed out getting Updates: %s', toe) | |||
# If getUpdates() failed due to timeout, we should retry asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_updates() maybe?
Fix comment per Eldinnie's request
@Eldinnie
|
Good, merge after #1006 |
@Eldinnie Why after? |
@tsnoam not really needed maybe, but that will make CI pass. And I prefer t if master passes CI |
TimedOut exception is an expected an normal event. To reduce noise and
make things more "fluent" we now:
immediately.
Fixes #802