Close arkhamdb session in a more clean way

This commit is contained in:
Adam Goldsmith 2021-05-03 00:48:34 -04:00
parent 344c65398c
commit 81a083618d
2 changed files with 4 additions and 4 deletions

View File

@ -25,6 +25,10 @@ class ArkhamDBUpdater(commands.Bot):
self.arkhamdb_client = ArkhamDBClient()
self.setup_commands()
async def close(self) -> None:
await self.arkhamdb_client.close()
await super().close()
def setup_commands(self):
@self.command(name='monitor')
async def monitor(ctx: commands.Context):

View File

@ -17,10 +17,6 @@ class ArkhamDBClient:
self._session = aiohttp.ClientSession()
self.origin = arkhamdb_origin
def __del__(self):
loop = asyncio.get_event_loop()
loop.run_until_complete(self.close())
async def close(self):
await self._session.close()