-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Expose close() method in client instances #1810
Conversation
32749ea
to
0646560
Compare
0646560
to
1d118f9
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1810 +/- ##
==========================================
+ Coverage 92.2% 92.5% +0.29%
==========================================
Files 53 53
Lines 9958 9966 +8
==========================================
+ Hits 9182 9219 +37
+ Misses 776 747 -29
Continue to review full report at Codecov.
|
6387309
to
0c16157
Compare
Greetings! It looks like this issue hasn’t been active in longer than one year. We encourage you to check if this is still an issue in the latest release. Because it has been longer than one year since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment to prevent automatic closure, or if the issue is already closed, please feel free to reopen it. |
0c16157
to
f2ee289
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1810 +/- ##
========================================
Coverage 95.29% 95.30%
========================================
Files 60 60
Lines 12252 12260 +8
========================================
+ Hits 11676 11684 +8
Misses 576 576
Continue to review full report at Codecov.
|
There still is no |
f2ee289
to
7b3bb00
Compare
Rebased to be against current top of |
👍 , would love to see this get merged – I currently have to rely on
|
Could we get e.g. @nateprewitt to take a look at this? |
If I wanted the client to be long-lived in order to maximize the benefit of the connection pool, would I still get the warnings from #454 even with the changes from this PR? |
7b3bb00
to
2e6b2c1
Compare
Hi @vtermanis, I left a response to boto/boto3#454 a bit earlier. I think we're going to try and get this added to an upcoming release. I've rebased your change onto our current I think we'll likely want to add some doc changes and potentially a couple more tests before merging. I'm still working through what those will be and will update once we have more. Please let me know if you'd like to continue this work or would rather I build on top of your existing PR. Thanks! |
@hannes-ucsc, to answer your question, you would likely still see these warnings for long-lived clients. The existence of the ConnectionPool is what's causing these warnings to arise. The outcome of this PR will only provide the ability to forcibly cleanup client ConnectionPools when you're finished with them. |
@nateprewitt - Thanks for considering this. It's been a while since I look at the codebase (and I don't have quite as much time as I used to - though I guess who has, eh?) - so I think you building on top of this will be more efficient at this point. If I need to sign/tick some contribution-related box somewhere, let me know. (Though if this is not needed - that's fine by me.) |
2e6b2c1
to
4efc6e3
Compare
- Enable pooled/keep-alive connections to be closed explicitly - Add tests for client, endpoint & session close()
4efc6e3
to
1495b2c
Compare
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.
Alright, things are rebased and the tests are cleaned up. Let's ship it! Thanks again, @vtermanis
boto/boto3#454 (comment) says the following regarding this PR:
Is that still the case with the final code that was merged? (from an outsider's brief look it would appear so) I couldn't find any documentation either in this PR or generally on boto3/botocore docs so I'm wondering whether |
If that’s the case shouldn’t the close() method be on the session and not the client/resource? It’s where I looked for a method first before finding this ticket and using the version in the client as in the comments above. |
Although the (now outdated) #1499 (add
__del__
) and #1231 (close/release connection back to pool) try to address boto/boto3#454 , this PR suggests simply exposing aclose
method onbotocore.client
client instances. It should then be possible to e.g. usecontextlib.closing
or to manually close the client after usage:I have not added any tests since I wasn't sure what would be appropriate. This additional method however should not affect any existing behaviour.Have added test to exercise the new methods.