-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Clarify / improve progressiveTimeout #3840
Comments
and then callers would look like
|
@gnprice Would you prefer that I put this in a PR, as it's kind of a large code block here? It's rough, though, so I'd mark it as WIP. |
I supposed it was clearer to make the timeout duration a function of |
Hmm, looking at that last code block (what callers look like), it wouldn't handle well the proposed case where |
(Now making changes based on feedback in person — in particular, not making it configurable; instead, the "give up" logic will be handled at .wait() call sites.) |
Fixes: zulip#3840. Replace progressiveTimeout with makeBackoffMachine, which is called above a loop, and .wait() can be called inside the loop on the returned backoffMachine. Give access to numSleepsCompleted and timeElapsedSoFar so "give up" logic (e.g., on too many network requests with transient failures) can be handled near .wait() call sites. Prepare for work on zulip#3829 (a permanent timeout on sending outbox messages). Previously, the state logic in progressiveTimeout was global, which meant a potentially desirable general throttle on all network requests that used it, but the drawbacks were greater. A particular call to progressiveTimeout was nondeterministic, because other calls may have been made recently, affecting the resulting delay duration. A 60-second threshold was used as a heuristic to distinguish request retry loops from each other, but this is much more effectively done with the new interface.
Here's an initial proposal for a new way of handing our progressiveTimeout sleeps, based on a discussion at #3829 (comment).
The most important change is that this doesn't use a global state for the sleep duration. We don't usually want the sleeping durations for different, potentially unrelated network requests to interfere with each other, especially given another proposal made in response to that issue, that we can give the caller the option to make the promise reject if it's time to give up on that network request, which would help with features like this:
The text was updated successfully, but these errors were encountered: