Manually implement client.Wait backoffs#4200
Merged
jedevc merged 2 commits intomoby:masterfrom Sep 7, 2023
Merged
Conversation
cd792e9 to
d09ed9d
Compare
This reverts commit 1aef766. Signed-off-by: Justin Chadwell <me@jedevc.com>
crazy-max
reviewed
Sep 5, 2023
Member
crazy-max
left a comment
There was a problem hiding this comment.
The automatic retries for transient errors and recover gracefully when the service is unavailable temporarily looks good enough but I wonder if we should consider a maximum retry limit as well.
Member
Author
I think the |
Member
Looks good 👍 |
d09ed9d to
8b6fb78
Compare
tonistiigi
reviewed
Sep 6, 2023
When calling client.Wait, we want to avoid the default backoff behavior, because we want to achieve a quick response back once the server becomes active. To do this, without modifying the entire client's exponential backoff configuration, we can use conn.ResetConnectBackoff, while attempting to reconnect every second. Here are some common scenarios: - Server is listening: the call to Info succeeds quickly, and we return. - Server is listening, but is behind several proxies and so latency is high: the call to Info succeeds slowly (up to minConnectTimeout=20s), and we return. - Server is not listening and gets "connection refused": the call to Info fails quickly, and we wait a second before retrying. - Server is not listening and does not respond (e.g. firewall dropping packets): the call to Info fails slowly (by default after minConnectTimeout=20s). After the call fails, we wait a second before retrying. Signed-off-by: Justin Chadwell <me@jedevc.com>
8b6fb78 to
f1d7f2e
Compare
tonistiigi
approved these changes
Sep 6, 2023
This was referenced Oct 3, 2023
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🛠️ Fixes regression #4164, while preserving the spirit of #4015.
◀️ Reverts #4015.
When calling
client.Wait, we want to avoid the default backoff behavior, because we want to achieve a quick response back once the server becomes active.To do this, without modifying the entire client's exponential backoff configuration, we can use
conn.ResetConnectBackoff, while attempting to reconnect every second.Here are some common scenarios under the new
client.Waitimplementation:Infosucceeds quickly, and we return.Infosucceeds slowly (up tominConnectTimeout=20s), and we return.minConnectTimeout, thenclient.Waitwill never return."connection refused": the call toInfofails quickly, and we wait a second before retrying.Infofails slowly (by default afterminConnectTimeout=20s). After the call fails, we wait a second before retrying.This PR is split into two commits:
client.Wait.