-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
x/net/http2: expose CloseIfIdle and ClientConnPoolIdleCloser #17775
Comments
CL https://golang.org/cl/32326 mentions this issue. |
@bradfitz: any interest for this PR? |
I am on leave for a couple months, so I'll let @tombergan handle this. But I do not think it's a good idea to expose tons of innards of http2. That constrains us in the future. I'd rather see this bug phrased in terms of the problem rather than the solution. |
We are implementing our own But we could have our pool handling idle connections by itself, without relying on this |
This seems entirely reasonable. http2.Transport.CloseIdleConnections() is a no-op when the transport uses a custom ClientConnPool. This is a definite wart. I don't see a better way to do this other than exporting ClientConn.CloseIfIdle. |
What is missing to merge this PR? |
@rs just a minor doc nit that @tombergan had suggested then a rebase and we can run the trybots and get some approvals. @bradfitz as you are back, please feel free to take a look at the CL https://go-review.googlesource.com/c/net/+/32326. |
The http2
Transport
exposes aCloseIdleConnections
method that will call the method of the same name on theClientConnPool
if it implements the privateclientConnPoolIdleCloser
interface. TheClientConnPool
implementation calls the private methodcloseIfIdle
on each pooledClientConn
.If one want to create a custom
ClientConnPool
, there is no way to make this custom pool support this feature without exposingCloseIfIdle
method andClientConnPoolIdleCloser
interface.The text was updated successfully, but these errors were encountered: