Add logging to failed subscriptions.

This commit is contained in:
2025-07-27 17:23:29 +10:00
parent 288f706c89
commit ab0c827f19

View File

@@ -97,18 +97,23 @@ class TrackerComponent(cmds.Component):
responses = []
for sub in subs:
if self.bot.using_webhooks:
resp = await self.bot.subscribe_webhook(sub)
else:
resp = await self.bot.subscribe_websocket(sub)
responses.append(resp)
try:
if self.bot.using_webhooks:
resp = await self.bot.subscribe_webhook(sub)
else:
resp = await self.bot.subscribe_websocket(sub)
responses.append(resp)
except Exception:
logger.exception("Failed to subscribe to %s", str(sub))
for sub in usersubs:
if self.bot.using_webhooks:
resp = await self.bot.subscribe_webhook(sub)
else:
resp = await self.bot.subscribe_websocket(sub, token_for=channel.userid)
responses.append(resp)
try:
if self.bot.using_webhooks:
resp = await self.bot.subscribe_webhook(sub)
else:
resp = await self.bot.subscribe_websocket(sub, token_for=channel.userid, as_bot=False)
responses.append(resp)
except Exception:
logger.exception("Failed to subscribe to %s", str(sub))
logger.info("Finished tracker subscription to %s: %s", channel.userid, ', '.join(map(str, responses)))