fix(WebSocketShard): wait for hello rather than ready in connect (#9178)

This commit is contained in:
DD
2023-02-27 21:37:16 +02:00
committed by GitHub
parent ffdb197f98
commit 27e0b32c5f
2 changed files with 4 additions and 3 deletions

View File

@@ -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<FetchingStrategyOptions> {
// 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,

View File

@@ -164,7 +164,7 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
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;