Skip to content

Commit

Permalink
fix: reset http的close方法
Browse files Browse the repository at this point in the history
  • Loading branch information
veehou committed Jul 14, 2022
1 parent b6761ea commit 2d40b0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions botpy/client.py
Expand Up @@ -98,6 +98,8 @@ async def close(self) -> None:

self._closed = True

await self.http.close()

def is_closed(self) -> bool:
return self._closed

Expand Down
6 changes: 5 additions & 1 deletion botpy/http.py
Expand Up @@ -87,9 +87,13 @@ def __init__(
self.is_sandbox = is_sandbox

self._token: Optional[Token] = None if not app_id else Token(app_id=app_id, access_token=token)
self._session: Optional[aiohttp.ClientSession] = None
self._global_over: Optional[asyncio.Event] = None
self._headers: Optional[dict] = None
self._session: Optional[aiohttp.ClientSession] = None

async def close(self) -> None:
if self._session:
await self._session.close()

async def check_session(self):
if not self._headers:
Expand Down

0 comments on commit 2d40b0b

Please sign in to comment.