I have a list of tasks that I am awaiting and the fastest response will be saved and rest will be cancelled
done, pending = await asyncio.wait(
futures, return_when=FIRST_COMPLETED)
print(done.pop().result())
for future in pending:
future.cancel()
Each of these futures has this
session = asyncio.CreateSession()
# some code to request
# some code to process response
await session.close()
When I cancel the other futures, I get a warning
Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x10f95c6d8>
What is the best way to close this open session before cancelling the task?