[FEATURE] Re-create aiohttp.ClientSession
after using close()
on AsyncOpensearch
#637
Labels
enhancement
New feature or request
Is your feature request related to a problem?
I find it pretty annoying to handle the
close()
method ofAsyncOpensearch
. Basically, once closed, the client becomes unusable because every attempt to connect to the Opensearch cluster will yield the erroropensearchpy.exceptions.ConnectionError: ConnectionError(Session is closed) caused by: RuntimeError(Session is closed)
.What solution would you like?
This happens because
close()
effectively closes theaiohttp.ClientSession
without removing the attribute fromAsyncHttpSession
. A simple solution would be to writeself.session = None
right afteropensearch-py/opensearchpy/connection/http_async.py
Line 279 in e323ab2
What alternatives have you considered?
Re-creating the
AsyncOpensearch
instance, which bring unecessary overhead?Do you have any additional context?
How to create a
RuntimeError
:The text was updated successfully, but these errors were encountered: