-
Notifications
You must be signed in to change notification settings - Fork 718
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
Option to close connection for each HTTP request #31
Conversation
7012083
to
8e370bd
Compare
@aanm Thanks for the PR. Technically there is no leak as per golang core. Below note taken from golang godoc- // For client requests, setting this field prevents re-use of
// TCP connections between requests to the same hosts, as if
// Transport.DisableKeepAlives were set.
Close bool So there is no issue with I would say it up to developer or user choose the behavior they need. My recommendation is to expose some sort setter method to your thoughts? |
@jeevatkm True, on my use case all connection were for the same host but with multiple resty clients. Setting that option to true dropped the number of connections open by 70%. I'll think on something an make it as an option. Any ideas where it would be the best place to put it? |
You have specific use case. No issues. Best place is to -
finally assign in it the request (you already pick spot for this PR, but small change): r.RawRequest.Close = c.closeConnection |
Test case please and watch out travis ci build. |
Signed-off-by: André Martins <[email protected]>
8e370bd
to
84d1c0e
Compare
Current coverage is 96.99%@@ master #31 diff @@
==========================================
Files 5 5
Lines 759 766 +7
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 736 743 +7
Misses 13 13
Partials 10 10
|
@jeevatkm ping |
Signed-off-by: André Martins [email protected]