Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

aio: return session closing coroutine #276

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RazAnyVision
Copy link

@RazAnyVision RazAnyVision commented Mar 14, 2020

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 RazAnyVision changed the title aio.Consul.close() uses aiohttp.ClientSession.close() which returns a… aio: wait for session close Mar 14, 2020
@RazAnyVision RazAnyVision changed the title aio: wait for session close aio: return session closing coroutine Mar 14, 2020
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: [<a long list of 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.
@poppyred
Copy link

@RazAnyVision Interested in coming here

@cablehead cablehead force-pushed the master branch 2 times, most recently from 636f367 to a91daae Compare April 15, 2024 01:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants