From 6b8a2f64f8553e172ba351c30af822d334e5f118 Mon Sep 17 00:00:00 2001 From: HgO Date: Sat, 9 Jul 2022 00:02:34 +0200 Subject: [PATCH] add missing await --- matrix_alertbot/alertmanager.py | 6 ------ matrix_alertbot/main.py | 2 +- matrix_alertbot/webhook.py | 6 ------ 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/matrix_alertbot/alertmanager.py b/matrix_alertbot/alertmanager.py index 7d97c16..1f278e0 100644 --- a/matrix_alertbot/alertmanager.py +++ b/matrix_alertbot/alertmanager.py @@ -21,12 +21,6 @@ class AlertmanagerClient: self.cache = cache self.session = aiohttp.ClientSession() - async def __aenter__(self) -> AlertmanagerClient: - return self - - async def __aexit__(self, exc_type: Any, exc: Any, tb: Any) -> None: - await self.close() - async def close(self) -> None: await self.session.close() diff --git a/matrix_alertbot/main.py b/matrix_alertbot/main.py index d9647d8..7995ae9 100644 --- a/matrix_alertbot/main.py +++ b/matrix_alertbot/main.py @@ -97,7 +97,7 @@ async def start_matrix_client( # Sleep so we don't bombard the server with login requests await asyncio.sleep(15) finally: - client.close() + await client.close() def main() -> None: diff --git a/matrix_alertbot/webhook.py b/matrix_alertbot/webhook.py index 56b2752..375624a 100644 --- a/matrix_alertbot/webhook.py +++ b/matrix_alertbot/webhook.py @@ -64,12 +64,6 @@ class Webhook: self.port = config.port self.socket = config.socket - async def __aenter__(self) -> Webhook: - return self - - async def __aexit__(self, exc_type: Any, exc: Any, tb: Any) -> None: - await self.close() - async def start(self) -> None: await self.runner.setup()