python-consul icon indicating copy to clipboard operation
python-consul copied to clipboard

aio: return session closing coroutine

Open RazAnyVision opened this issue 5 years ago • 1 comments

aio.Consul.close() uses aiohttp.ClientSession.close() which returns a coroutine that was never awaited. When this happens, RuntimeWarnings are raised on termination:

RuntimeWarning: coroutine 'ClientSession.close' was never awaited self._session.close() RuntimeWarning: Enable tracemalloc to get the object allocation traceback Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7fee7d894340> Unclosed connector connections: [] connector: <aiohttp.connector.TCPConnector object at 0x7fee7d894310>

In this change the coroutine will be returned so it could be awaited and by that avoids these warnings.

RazAnyVision avatar Mar 14 '20 00:03 RazAnyVision

@RazAnyVision Interested in coming here

poppyred avatar May 14 '20 04:05 poppyred