refactor(discord): trim the first-strike comment to its WHY

The six-line comment above the terminal-reason check
(plugins/platforms/discord/adapter.py:1789-1794) restated the resume-swap
mechanism already documented in the test docstring and the issue. Keep the
one sentence that carries the intent (closed transport = confirmed death,
soft signals keep the threshold) and the #118487 pointer. No code change.
This commit is contained in:
kshitijk4poor
2026-09-22 12:26:53 +05:30
committed by kshitij
parent aba2e25390
commit 533796a833

View File

@@ -1786,12 +1786,8 @@ class DiscordAdapter(DiscordMediaMixin, BasePlatformAdapter):
"[%s] Discord Gateway WebSocket unhealthy (%s, %d/%d)", self.name, reason, failures,
threshold,
)
# A closed transport (``socket_closed``) is a confirmed death, not a suspicion:
# the resume path replaces the socket, the next sample reads healthy, and this
# counter silently resets — while a resumed-but-deaf session stays event-starved
# until the multi-hour event-silence default elapses (#118487). Escalate the
# first ``socket_closed`` / ``client_closed`` strike (both mean the transport is
# gone); soft signals (ack staleness, latency, silence) keep the threshold.
# A closed transport is a confirmed death, not a suspicion: escalate on the
# first strike; soft signals keep the threshold (#118487).
terminal = reason in ("socket_closed", "client_closed")
if failures < threshold and not terminal:
continue