Skip to content

Commit

Permalink
Ensure liveness_timeout is used correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Paul committed Dec 2, 2021
1 parent da70c9a commit e0da4a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mautrix_telegram/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def prepare_bridge(self) -> None:
if self.config['metrics.enabled']:
self.as_connection_metric_task = self.loop.create_task(self._loop_check_as_connection_pool())

if self.config['telegram.liveness_timeout']:
if self.config['telegram.liveness_timeout'] and self.config['telegram.liveness_timeout'] >= 1:
self.loop.create_task(self._loop_check_bridge_liveness())

async def start(self) -> None:
Expand Down Expand Up @@ -235,7 +235,7 @@ async def _loop_check_as_connection_pool(self) -> None:

async def _loop_check_bridge_liveness(self) -> None:
while True:
if self.latest_telegram_update_timestamp and self.latest_telegram_update_timestamp < time() - PORTAL_INACTIVE_THRESHOLD:
if self.latest_telegram_update_timestamp and self.latest_telegram_update_timestamp < time() - self.config['telegram.liveness_timeout']:
self.az.live = False

await asyncio.sleep(15)
Expand Down

0 comments on commit e0da4a1

Please sign in to comment.