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

Implemented client-side timeout for getUpdates #85

Merged
merged 1 commit into from Apr 13, 2023

Conversation

yglukhov
Copy link
Contributor

This PR fixes the hang in case of network interruption during getUpdates.

Steps to reproduce: unplug/replug the network cable or disconnect/reconnect to wifi, while the program is in getUpdates call, which is almost 100% of the time usually.

The hang happens because on the lowest level epoll doesn't notify us of network interruption (unless tcp keepalive is enabled), and such socket will never produce any read event after the interruption.

The fix is to introduce a timeout over http request. Conveniently we already have the timeout notion on the protocol level, so we reuse this value (only adding 10 seconds to it just in case).

@ba0f3 ba0f3 merged commit 93eb5e1 into ba0f3:master Apr 13, 2023
@ba0f3
Copy link
Owner

ba0f3 commented Apr 13, 2023

Awesome, thank you!

@yglukhov yglukhov deleted the update-timeout branch April 13, 2023 14:25
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.

None yet

2 participants