From 320c9b4b91370d90f309fd407e154a3dec4cd539 Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Fri, 16 Apr 2021 19:16:08 +0200 Subject: [PATCH] Update handle_on_message.ts --- src/ws/handle_on_message.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ws/handle_on_message.ts b/src/ws/handle_on_message.ts index a4145e33d..960c3cfeb 100644 --- a/src/ws/handle_on_message.ts +++ b/src/ws/handle_on_message.ts @@ -8,6 +8,7 @@ import { delay } from "../util/utils.ts"; import { decompressWith } from "./deps.ts"; import { identify } from "./identify.ts"; import { resume } from "./resume.ts"; +import { sendShardMessage } from "./send_shard_message.ts"; import { ws } from "./ws.ts"; /** Handler for handling every message event from websocket. */ @@ -38,11 +39,10 @@ export async function handleOnMessage(message: any, shardId: number) { shard.heartbeat.lastSentAt = Date.now(); // Discord randomly sends this requiring an immediate heartbeat back - shard.queue.unshift({ + sendShardMessage(shard, { op: DiscordGatewayOpcodes.Heartbeat, d: shard?.previousSequenceNumber, - }); - ws.processQueue(shard.id); + }, true); break; case DiscordGatewayOpcodes.Hello: ws.heartbeat(