-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
persistent client #806
Comments
If you don't close the client you'll get warnings about unclosed connections it's better to use AsyncExitStack and then aexit that when you're done |
I'm going to leave this open to remember to do some examples about this topic |
ex: exit_stack = AsyncExitStack()
s3_client = await exit_stack.enter_async_context(_SESSION.create_client('s3')) then later during shutdown: await exit_stack.__aexit__(None, None, None) the nice thing of exitstack is you can stick a bunch of things in it |
awesome. thanks for the heads up. ive been using you could probably add a |
but that's on a |
https://aioboto3.readthedocs.io/en/latest/usage.html#aiohttp-server-example I have an example, you should add one too 😉 |
ok added a couple examples to the front page, please re-open if that doesn't fit the bill :) |
@thehesiod @terrycain Is it safe to persist the
If that's so, why not expose the |
persisting the client is ok, however its better to put into a context to be cleaned up when you process/function exits, just better style to let you know the client should be cleaned up |
I understand you changed the api to make a client accessible only from a context manager, but is it still safe to persist the client anyway?
I am using the following to persist it.
The text was updated successfully, but these errors were encountered: