mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
fix(WebSocketShard): wait for hello rather than ready in connect (#9178)
This commit is contained in:
@@ -5,7 +5,7 @@ import type { SessionInfo, WebSocketManager, WebSocketManagerOptions } from '../
|
|||||||
export interface FetchingStrategyOptions
|
export interface FetchingStrategyOptions
|
||||||
extends Omit<
|
extends Omit<
|
||||||
WebSocketManagerOptions,
|
WebSocketManagerOptions,
|
||||||
'rest' | 'retrieveSessionInfo' | 'shardCount' | 'shardIds' | 'updateSessionInfo'
|
'buildStrategy' | 'rest' | 'retrieveSessionInfo' | 'shardCount' | 'shardIds' | 'updateSessionInfo'
|
||||||
> {
|
> {
|
||||||
readonly gatewayInformation: APIGatewayBotInfo;
|
readonly gatewayInformation: APIGatewayBotInfo;
|
||||||
readonly shardCount: number;
|
readonly shardCount: number;
|
||||||
@@ -23,7 +23,8 @@ export interface IContextFetchingStrategy {
|
|||||||
|
|
||||||
export async function managerToFetchingStrategyOptions(manager: WebSocketManager): Promise<FetchingStrategyOptions> {
|
export async function managerToFetchingStrategyOptions(manager: WebSocketManager): Promise<FetchingStrategyOptions> {
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
// 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 {
|
return {
|
||||||
...managerOptions,
|
...managerOptions,
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ export class WebSocketShard extends AsyncEventEmitter<WebSocketShardEventsMap> {
|
|||||||
this.sendRateLimitState = getInitialSendRateLimitState();
|
this.sendRateLimitState = getInitialSendRateLimitState();
|
||||||
|
|
||||||
const { ok } = await this.bubbleWaitForEventError(
|
const { ok } = await this.bubbleWaitForEventError(
|
||||||
this.waitForEvent(WebSocketShardEvents.Ready, this.strategy.options.readyTimeout),
|
this.waitForEvent(WebSocketShardEvents.Hello, this.strategy.options.helloTimeout),
|
||||||
);
|
);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user