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

Reset backoff interval after successful connection #554

Open
gnprice opened this issue Mar 8, 2024 · 0 comments · May be fixed by #564
Open

Reset backoff interval after successful connection #554

gnprice opened this issue Mar 8, 2024 · 0 comments · May be fixed by #564
Labels
a-api Implementing specific parts of the Zulip server API

Comments

@gnprice
Copy link
Member

gnprice commented Mar 8, 2024

Since #184, we retry long-poll failures, with exponential backoff up to an interval of 10 seconds.

Even after the device is again able to reach the server, though, the backoff interval on next failure remains 10 seconds, for as long as the app keeps running. That seems unhelpful. Instead, when we find we can again consistently reach the server, the backoff intervals should reset to what they would be if the app were restarted.

The simplest thing to do here would be: as soon as there's one more success, just reset the backoff to its initial state. I'm not sure if a more complex strategy would be best in general. But I think for these long-poll requests the simple thing is fine, for the reasons below.

Detailed reasoning

The possible risk in completely resetting backoff on a single success is that if the server is having trouble and handling some but not all its requests, that plan would mean we'd do a lot more retries, partway toward what would happen if we weren't backing off at all. I'm not sure if there's a standard recommendation for how to strike a balance there.

However, these particular requests are a long-poll — which means that a successful request most often takes a long time to come back: up to 60 seconds. Probably most of the time it's longer than our max backoff interval of 10 seconds. So if after that, our next request randomly fails (because the server is having trouble) and we retry in 100ms, that's not that different from if we retry after 10 seconds.

@gnprice gnprice added the a-api Implementing specific parts of the Zulip server API label Mar 8, 2024
@gnprice gnprice added this to the Beta 3 milestone Mar 8, 2024
@chrisbobbe chrisbobbe linked a pull request Mar 26, 2024 that will close this issue
chrisirhc added a commit to chrisirhc/zulip-flutter that referenced this issue Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-api Implementing specific parts of the Zulip server API
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

1 participant