fix(discord): log an unexpected liveness-probe exit at WARNING (from #118504)

The guard exit in _liveness_loop fires for two very different reasons:
ordinary teardown (adapter stopped or disconnecting), and a still-running
adapter whose client vanished. The first is noise at INFO; the second
means the gateway keeps running with no watchdog (#118487) and must stand
out in an incident log. Pick the level from the exit cause instead of
logging both at INFO.

Co-authored-by: Konstantin Khlopkov <47825603+kokhlo@users.noreply.github.com>
This commit is contained in:
kshitijk4poor
2026-09-22 11:54:27 +05:30
committed by kshitij
parent 7f3795e72d
commit 43499c4531

View File

@@ -1754,8 +1754,12 @@ class DiscordAdapter(DiscordMediaMixin, BasePlatformAdapter):
client = self._client
if not self._running or client is None or self._disconnecting:
# The probe must never disappear silently (#118487): an exit here leaves the
# gateway alive with no watchdog, so say why before going away.
logger.info(
# gateway alive with no watchdog, so say why before going away. Teardown
# (stopped or disconnecting) is expected; a still-running adapter losing
# its client mid-flight is not, and an operator must be able to spot it.
expected_exit = not self._running or self._disconnecting
logger.log(
logging.INFO if expected_exit else logging.WARNING,
"[%s] Discord liveness probe exiting (running=%s, client=%s, disconnecting=%s)",
self.name, self._running, client is not None, self._disconnecting,
)