From 27e0b32c5f0fe605f152e6ba67ce3f596137ff01 Mon Sep 17 00:00:00 2001 From: DD Date: Mon, 27 Feb 2023 21:37:16 +0200 Subject: [PATCH] fix(WebSocketShard): wait for hello rather than ready in connect (#9178) --- .../ws/src/strategies/context/IContextFetchingStrategy.ts | 5 +++-- packages/ws/src/ws/WebSocketShard.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/ws/src/strategies/context/IContextFetchingStrategy.ts b/packages/ws/src/strategies/context/IContextFetchingStrategy.ts index e9c0ad64e..6f6c3155d 100644 --- a/packages/ws/src/strategies/context/IContextFetchingStrategy.ts +++ b/packages/ws/src/strategies/context/IContextFetchingStrategy.ts @@ -5,7 +5,7 @@ import type { SessionInfo, WebSocketManager, WebSocketManagerOptions } from '../ export interface FetchingStrategyOptions extends Omit< WebSocketManagerOptions, - 'rest' | 'retrieveSessionInfo' | 'shardCount' | 'shardIds' | 'updateSessionInfo' + 'buildStrategy' | 'rest' | 'retrieveSessionInfo' | 'shardCount' | 'shardIds' | 'updateSessionInfo' > { readonly gatewayInformation: APIGatewayBotInfo; readonly shardCount: number; @@ -23,7 +23,8 @@ export interface IContextFetchingStrategy { export async function managerToFetchingStrategyOptions(manager: WebSocketManager): Promise { // eslint-disable-next-line @typescript-eslint/unbound-method - const { retrieveSessionInfo, updateSessionInfo, shardCount, shardIds, rest, ...managerOptions } = manager.options; + const { buildStrategy, retrieveSessionInfo, updateSessionInfo, shardCount, shardIds, rest, ...managerOptions } = + manager.options; return { ...managerOptions, diff --git a/packages/ws/src/ws/WebSocketShard.ts b/packages/ws/src/ws/WebSocketShard.ts index e868ad5ca..5330fa5ef 100644 --- a/packages/ws/src/ws/WebSocketShard.ts +++ b/packages/ws/src/ws/WebSocketShard.ts @@ -164,7 +164,7 @@ export class WebSocketShard extends AsyncEventEmitter { this.sendRateLimitState = getInitialSendRateLimitState(); const { ok } = await this.bubbleWaitForEventError( - this.waitForEvent(WebSocketShardEvents.Ready, this.strategy.options.readyTimeout), + this.waitForEvent(WebSocketShardEvents.Hello, this.strategy.options.helloTimeout), ); if (!ok) { return;