Skip to content

Commit a01b470

Browse files
author
Christian Paul
authored
Set up as_connection_metric_task during start
1 parent 5211f95 commit a01b470

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mautrix_telegram/__main__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,15 @@ def prepare_bridge(self) -> None:
116116
if self.config['bridge.limits.enable_activity_tracking'] is not False:
117117
self.periodic_sync_task = self.loop.create_task(self._loop_active_puppet_metric())
118118

119-
if self.config['metrics.enabled']:
120-
self.as_connection_metric_task = self.loop.create_task(self._loop_check_as_connection_pool())
121-
122119
if self.config.get('telegram.liveness_timeout', 0) >= 1:
123120
self.as_bridge_liveness_task = self.loop.create_task(self._loop_check_bridge_liveness())
124121

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

125+
if self.config['metrics.enabled']:
126+
self.as_connection_metric_task = self.loop.create_task(self._loop_check_as_connection_pool())
127+
128128
if self.bot:
129129
try:
130130
await self.bot.start()
@@ -225,7 +225,7 @@ async def _loop_check_as_connection_pool(self) -> None:
225225
while True:
226226
try:
227227
# a horrible reach into Appservice's internal API
228-
connector = self.az._http_session.connector
228+
connector = self.az.http_session().connector
229229
limit = connector.limit
230230
# a horrible, horrible reach into asyncio.TCPConnector's internal API
231231
# inspired by its (also private) _available_connections()

0 commit comments

Comments
 (0)