Skip to content

Conversation

saadjsct
Copy link

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

Copy link
Collaborator

@non-Jedi non-Jedi left a 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):
Copy link
Collaborator

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
Copy link
Collaborator

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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs docstring.

@makefu
Copy link

makefu commented Nov 4, 2020

i'd love to see this being merged

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.

3 participants