fix(WebSocketShard): dispatch race condition (#8731)

This commit is contained in:
DD
2022-10-10 20:15:04 +03:00
committed by GitHub
parent ac83ada306
commit c2b677759b

View File

@@ -383,10 +383,6 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
switch (payload.op) {
case GatewayOpcodes.Dispatch: {
if (this.status === WebSocketShardStatus.Ready || this.status === WebSocketShardStatus.Resuming) {
this.emit(WebSocketShardEvents.Dispatch, { data: payload });
}
if (this.status === WebSocketShardStatus.Resuming) {
this.replayedEvents++;
}
@@ -425,6 +421,8 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
await this.strategy.updateSessionInfo(this.id, this.session);
}
this.emit(WebSocketShardEvents.Dispatch, { data: payload });
break;
}