Skip to content

Commit

Permalink
Set up as_connection_metric_task during start
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Paul authored Dec 3, 2021
1 parent 5211f95 commit a01b470
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mautrix_telegram/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ def prepare_bridge(self) -> None:
if self.config['bridge.limits.enable_activity_tracking'] is not False:
self.periodic_sync_task = self.loop.create_task(self._loop_active_puppet_metric())

if self.config['metrics.enabled']:
self.as_connection_metric_task = self.loop.create_task(self._loop_check_as_connection_pool())

if self.config.get('telegram.liveness_timeout', 0) >= 1:
self.as_bridge_liveness_task = self.loop.create_task(self._loop_check_bridge_liveness())

async def start(self) -> None:
await super().start()

if self.config['metrics.enabled']:
self.as_connection_metric_task = self.loop.create_task(self._loop_check_as_connection_pool())

if self.bot:
try:
await self.bot.start()
Expand Down Expand Up @@ -225,7 +225,7 @@ async def _loop_check_as_connection_pool(self) -> None:
while True:
try:
# a horrible reach into Appservice's internal API
connector = self.az._http_session.connector
connector = self.az.http_session().connector
limit = connector.limit
# a horrible, horrible reach into asyncio.TCPConnector's internal API
# inspired by its (also private) _available_connections()
Expand Down

0 comments on commit a01b470

Please sign in to comment.