-
Notifications
You must be signed in to change notification settings - Fork 6
Enable client-side timeouts #39
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
base: main
Are you sure you want to change the base?
Enable client-side timeouts #39
Conversation
.. to avoid the warning
While the `RetryPolicy` has a `MaxTotalDelayRetryPolicy`, the retry `loop` would only check this configured delay once the operation future actually returns a value. However, without client-side timeouts, we're not super sure the operation is actually guaranteed to return anything (even an error, IIUC). So here, we enable some coarse client-side default timeouts to ensure the polled futures eventualy return either the response *or* an error we can handle via our retry logic.
👋 Thanks for assigning @tankyleo as a reviewer! |
.timeout(DEFAULT_TIMEOUT) | ||
.connect_timeout(DEFAULT_TIMEOUT) | ||
.read_timeout(DEFAULT_TIMEOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you seems like we could just do with the single global timeout here, no need for connect and read ?
But we can leave it as is and potentially tweak the inner timeouts later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, no strong opinion here.
For reference original PR is #20. On first impression, I'd be in favor of the drop myself. |
Do the added timeouts apply to a single operation? If it is never exceeded, wouldn't we still want What is meant by client-side default delay? |
Yes, they apply for a single read, but also for connecting / detecting dropped connections AFAIU.
Yes, it could be useful, but of course its somewhat redundant if we set a client-side
Ah, sorry, that was a typo I only corrected in the PR title: should have said default timeout, not delay. |
Do you mean
Isn't this already the case when configured as I mentioned above? Number of attempts takes priority over total delay given the way Maybe I'm confused about what is lesser in that example. |
Yes, if each client call is also limited by a timeout, then we'd have either
Say you configure Or, maybe even a bit more confusing would be if the user configured a |
🔔 1st Reminder Hey @jkczyz! This PR has been waiting for your review. |
Isn't that expected? "done after 50s" is really "done after 5 attempts".
Yeah, though isn't that a good argument to use select? Or does the current design not allow that given policy timeout is built into the type rather than the calling site being aware of it? |
True, seems like we should? And given that we already use tokio with the time feature, it should be straightforward. I think I'll add a commit to this PR. |
Argh, after looking into it for a bit I have to eat my words: it's actually not trivial, as currently And more generally, with a generic error type, we don't know what error we'd return in case the the timeout happens before the |
Would it help defining an enum parameterized by the error |
🔔 2nd Reminder Hey @jkczyz! This PR has been waiting for your review. |
🔔 3rd Reminder Hey @jkczyz! This PR has been waiting for your review. |
🔔 4th Reminder Hey @jkczyz! This PR has been waiting for your review. |
Based on #38.
We enable
reqwest
client-level timeouts:One aspect that might be debatable here is whether we should drop
MaxTotalDelayRetryPolicy
given it would interact with the client-side default timeout. Hence also pinging @jkczyz who reviewed the original retry PR.