-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add cancellable context to Fetch requests #31
Conversation
Fetch requests that are Consul blocking queries leak on shutdown and hold onto the TCP connection causing Consul server to hold until reaped. This can quickly result in reaching Consul client connection limits and causing subsequent client restarts to error due to agent rate limits, 429 and EOFs.
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.
Looks great. No changes required (well you know, unless you want to ;).
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.
excited about these changes! i just had a couple questions of things that I wanted to make sure I understood and wanted to learn more about your thinking - no changes necessary.
Thanks for the review everyone! I do want to note that context is currently used for Consul dependencies, but are not piped through to the Vault dependencies yet. I'm not as familiar with those and for timing purposes, I focused on Consul. |
Fetch requests that are Consul blocking queries leak on shutdown and hold onto the TCP connection causing Consul server to also hold until reaped. This can quickly result in reaching Consul client connection limits and causing subsequent client restarts to error due to agent rate limits, 429 and EOFs.
The PR adds a cancellable context to the QueryOptions for the Consul API client to use for HTTP requests. This allows
view.Stop()
to cancel the context which cancels the in-flight request. Canceling the request releases the underlying TCP connection from active to now possible idle state, which could then be cleaned up whenClientSet.Stop()
->http.Client.CloseIdleConnections()
is called.