Skip to content

Commit

Permalink
Cancel as_bridge_liveness_task on stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Paul committed Dec 2, 2021
1 parent e0da4a1 commit 0878dac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mautrix_telegram/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 0878dac

Please sign in to comment.