From f780f044478162c38e86772775a64775737aeffb Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sun, 22 Feb 2026 16:59:18 -0500 Subject: [PATCH] Update last_send when receiving a HEARTBEAT request --- discord/gateway.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/discord/gateway.py b/discord/gateway.py index 75acf7e98..3f283ef71 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -210,6 +210,10 @@ class KeepAliveHandler(threading.Thread): def tick(self) -> None: self._last_recv = time.perf_counter() + def beat(self) -> Dict[str, Any]: + self._last_send = time.perf_counter() + return self.get_payload() + def ack(self) -> None: ack_time = time.perf_counter() self._last_ack = ack_time @@ -541,7 +545,7 @@ class DiscordWebSocket: if op == self.HEARTBEAT: if self._keep_alive: - beat = self._keep_alive.get_payload() + beat = self._keep_alive.beat() await self.send_as_json(beat) return