From 0878daca3a94f9b65c0e5888ea837c5c9fa90070 Mon Sep 17 00:00:00 2001 From: Christian Paul Date: Thu, 2 Dec 2021 15:41:28 +0100 Subject: [PATCH] Cancel as_bridge_liveness_task on stop --- mautrix_telegram/__main__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mautrix_telegram/__main__.py b/mautrix_telegram/__main__.py index 63dd1944..818f4f87 100644 --- a/mautrix_telegram/__main__.py +++ b/mautrix_telegram/__main__.py @@ -119,7 +119,7 @@ def prepare_bridge(self) -> None: self.as_connection_metric_task = self.loop.create_task(self._loop_check_as_connection_pool()) if self.config['telegram.liveness_timeout'] and self.config['telegram.liveness_timeout'] >= 1: - self.loop.create_task(self._loop_check_bridge_liveness()) + self.as_bridge_liveness_task = self.loop.create_task(self._loop_check_bridge_liveness()) async def start(self) -> None: await super().start() @@ -157,6 +157,8 @@ async def resend_bridge_info(self) -> None: def prepare_stop(self) -> None: if self.periodic_sync_task: self.periodic_sync_task.cancel() + if self.as_bridge_liveness_task: + self.as_bridge_liveness_task.cancel() for puppet in Puppet.by_custom_mxid.values(): puppet.stop() self.shutdown_actions = (user.stop() for user in User.by_tgid.values())