From cfd6cf157ee78081c7c2d27235c843da742ba25c Mon Sep 17 00:00:00 2001 From: Nick80835 Date: Mon, 6 Apr 2020 10:30:37 -0400 Subject: [PATCH] close aiohttp sessions on failure --- ubot/modules/danbooru.py | 1 + ubot/modules/gelbooru.py | 1 + ubot/modules/urbandict.py | 1 + 3 files changed, 3 insertions(+) diff --git a/ubot/modules/danbooru.py b/ubot/modules/danbooru.py index 4a5324f..843827a 100644 --- a/ubot/modules/danbooru.py +++ b/ubot/modules/danbooru.py @@ -38,6 +38,7 @@ async def danbooru(event): response = await response.json() else: await event.reply(f"`An error occurred, response code: `**{response.status}**") + await session.close() return await session.close() diff --git a/ubot/modules/gelbooru.py b/ubot/modules/gelbooru.py index 1faf5e1..5a3ff30 100644 --- a/ubot/modules/gelbooru.py +++ b/ubot/modules/gelbooru.py @@ -42,6 +42,7 @@ async def gelbooru(event): response = await response.json() else: await event.reply(f"`An error occurred, response code: `**{response.status}**") + await session.close() return await session.close() diff --git a/ubot/modules/urbandict.py b/ubot/modules/urbandict.py index a6baa20..852c986 100644 --- a/ubot/modules/urbandict.py +++ b/ubot/modules/urbandict.py @@ -30,6 +30,7 @@ async def urban_dict(event): response = await response.json() else: await event.reply(f"`An error occurred, response code:` **{response.status}**") + await session.close() return await session.close()