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.
This commit is contained in:
Vlad Frangu
2019-12-22 11:31:26 +02:00
committed by SpaceEEC
parent b4f00bfb6b
commit 710101c580
2 changed files with 2 additions and 1 deletions

View File

@@ -373,7 +373,6 @@ class WebSocketShard extends EventEmitter {
this.debug(`[READY] Session ${this.sessionID}.`); this.debug(`[READY] Session ${this.sessionID}.`);
this.lastHeartbeatAcked = true; this.lastHeartbeatAcked = true;
this.sendHeartbeat('ReadyHeartbeat'); this.sendHeartbeat('ReadyHeartbeat');
this.checkReady();
break; break;
case WSEvents.RESUMED: { case WSEvents.RESUMED: {
/** /**

View File

@@ -16,4 +16,6 @@ module.exports = (client, { d: data }, shard) => {
guild.shardID = shard.id; guild.shardID = shard.id;
client.guilds.add(guild); client.guilds.add(guild);
} }
shard.checkReady();
}; };