From 710101c5805935d7804fc8e53fa130541f248c54 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Sun, 22 Dec 2019 11:31:26 +0200 Subject: [PATCH] src(WebSocket): fix race condition (#3636) A race condition caused Client#user to be null in the ready event if the client handled 0 guilds. --- src/client/websocket/WebSocketShard.js | 1 - src/client/websocket/handlers/READY.js | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/websocket/WebSocketShard.js b/src/client/websocket/WebSocketShard.js index 8d9afd313..5171d7e59 100644 --- a/src/client/websocket/WebSocketShard.js +++ b/src/client/websocket/WebSocketShard.js @@ -373,7 +373,6 @@ class WebSocketShard extends EventEmitter { this.debug(`[READY] Session ${this.sessionID}.`); this.lastHeartbeatAcked = true; this.sendHeartbeat('ReadyHeartbeat'); - this.checkReady(); break; case WSEvents.RESUMED: { /** diff --git a/src/client/websocket/handlers/READY.js b/src/client/websocket/handlers/READY.js index 1612cfa02..002575023 100644 --- a/src/client/websocket/handlers/READY.js +++ b/src/client/websocket/handlers/READY.js @@ -16,4 +16,6 @@ module.exports = (client, { d: data }, shard) => { guild.shardID = shard.id; client.guilds.add(guild); } + + shard.checkReady(); };