fix bug
This commit is contained in:
parent
41bdbc8e37
commit
6fb440c842
|
@ -1,5 +1,4 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from contextlib import suppress
|
|
||||||
import os
|
import os
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
@ -67,12 +66,18 @@ class ClientSession:
|
||||||
return api
|
return api
|
||||||
|
|
||||||
async def __aexit__(self, *args):
|
async def __aexit__(self, *args):
|
||||||
with suppress(Exception):
|
try:
|
||||||
self.writer.close()
|
self.writer.close()
|
||||||
await self.writer.wait_closed()
|
await self.writer.wait_closed()
|
||||||
with suppress(Exception):
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.tasks[0].cancel()
|
self.tasks[0].cancel()
|
||||||
await self.tasks[0]
|
await self.tasks[0]
|
||||||
with suppress(Exception):
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.tasks[1].cancel()
|
self.tasks[1].cancel()
|
||||||
await self.tasks[1]
|
await self.tasks[1]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue