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

Client#sync fails with Net::ReadTimeout on large timeout values #26

Open
johannes-krude opened this issue Jan 18, 2022 · 1 comment
Open

Comments

@johannes-krude
Copy link
Contributor

Client#sync takes a timeout parameter which is the amount of time to wait in case no new events are happening.

Net:HTTP#read_timeout is the amount of time until Net::ReadTimeout is raised in case the read syscall does not return. The default for this is 60 (seconds).

When calling Client#sync with a large timeout (e.g. 10 minutes), Net::ReadTimeout is raised before the server responds with an empty response.

As a workaround Client#sync can be called multiple times with a small timeout value.

@ananace
Copy link
Owner

ananace commented Jan 18, 2022

The Matrix protocol itself works better when the client runs syncs more often, since that shrinks the window that the sync token might have to calculate. But if long-period syncs are necessary then you can modify that setting on the API object;

client = MatrixSdk::Client.new('https://matrix.example.com', read_timeout: 600)
# Or with an existing Client/API object;
client.api.read_timeout = 600

Bear in mind that even if your client is set to allow for a longer read timeout, the Matrix server on the other end might have a reverse proxy in front of it that could abort the connection as well.

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

No branches or pull requests

2 participants