-
Notifications
You must be signed in to change notification settings - Fork 119
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
added api connection_timeout to recover from lost connections #303
base: master
Are you sure you want to change the base?
Conversation
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.
Please also rebase on master so CI passes and signoff per https://github.com/matrix-org/matrix-python-sdk/blob/master/CONTRIBUTING.rst. I would also recommend transitioning to https://github.com/poljar/matrix-nio as it's actually maintained.
@@ -111,7 +111,8 @@ def global_callback(incoming_event): | |||
|
|||
def __init__(self, base_url, token=None, user_id=None, | |||
valid_cert_check=True, sync_filter_limit=20, | |||
cache_level=CACHE.ALL, encryption=False, encryption_conf=None): | |||
cache_level=CACHE.ALL, encryption=False, encryption_conf=None, | |||
api_connection_timeout=60): |
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.
Can we just call this timeout
instead of connection_timeout
or api_connection_timeout
for conciseness?
@@ -57,7 +57,8 @@ class MatrixHttpApi(object): | |||
def __init__( | |||
self, base_url, token=None, identity=None, | |||
default_429_wait_ms=5000, | |||
use_authorization_header=True | |||
use_authorization_header=True, | |||
connection_timeout=60 |
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.
Needs docstring
@@ -111,7 +111,8 @@ def global_callback(incoming_event): | |||
|
|||
def __init__(self, base_url, token=None, user_id=None, | |||
valid_cert_check=True, sync_filter_limit=20, | |||
cache_level=CACHE.ALL, encryption=False, encryption_conf=None): | |||
cache_level=CACHE.ALL, encryption=False, encryption_conf=None, | |||
api_connection_timeout=60): |
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.
Needs docstring.
i'd love to see this being merged |
if connection lost during listening the _send method does not return cause it calls self.session.request without the timeout keyword argument which defaults to None. i added an optional keyword argument to MatrixHttpApi and MatrixClient that specifies a timeout to pass to self.session.request