fix: break Discord typing loop on persistent HTTP failure
The typing indicator loop catches all exceptions with bare except/pass, so a permanent HTTP failure (client closed, auth error, etc.) causes the loop to spin every 8 seconds doing nothing until the channel is explicitly stopped. Log the error and exit the loop instead, letting the task clean up naturally.
This commit is contained in:
@@ -285,8 +285,11 @@ class DiscordChannel(BaseChannel):
|
|||||||
while self._running:
|
while self._running:
|
||||||
try:
|
try:
|
||||||
await self._http.post(url, headers=headers)
|
await self._http.post(url, headers=headers)
|
||||||
except Exception:
|
except asyncio.CancelledError:
|
||||||
pass
|
return
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug("Discord typing indicator failed for {}: {}", channel_id, e)
|
||||||
|
return
|
||||||
await asyncio.sleep(8)
|
await asyncio.sleep(8)
|
||||||
|
|
||||||
self._typing_tasks[channel_id] = asyncio.create_task(typing_loop())
|
self._typing_tasks[channel_id] = asyncio.create_task(typing_loop())
|
||||||
|
|||||||
Reference in New Issue
Block a user