From 6ec631f42b3a8e06fe61b9e137cb101ce5dcd8f0 Mon Sep 17 00:00:00 2001 From: Skillz Date: Sun, 12 Mar 2023 16:22:29 -0500 Subject: [PATCH] fix: invalid sessions should identify through manager --- packages/gateway/src/Shard.ts | 5 +---- packages/gateway/src/manager.ts | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/gateway/src/Shard.ts b/packages/gateway/src/Shard.ts index 40e3e64f2..73f735156 100644 --- a/packages/gateway/src/Shard.ts +++ b/packages/gateway/src/Shard.ts @@ -172,9 +172,6 @@ export class DiscordenoShard { await this.connect() } - // Wait until an identify is free for this this. - await this.requestIdentify() - this.send( { op: GatewayOpcodes.Identify, @@ -426,7 +423,7 @@ export class DiscordenoShard { // When resumable is false we need to re-identify if (!resumable) { - await this.identify() + await this.requestIdentify() break } diff --git a/packages/gateway/src/manager.ts b/packages/gateway/src/manager.ts index 1baacda68..b986c4d4d 100644 --- a/packages/gateway/src/manager.ts +++ b/packages/gateway/src/manager.ts @@ -164,8 +164,7 @@ export function createGatewayManager(options: CreateGatewayManagerOptions): Gate }, events: options.events, requestIdentify: async () => { - // TODO: remove this entire concept, its much easier to do in reality. - // await gateway.buckets.get(shardId % gateway.connection.sessionStartLimit.maxConcurrency)!.leak.acquire(shardId) + return await gateway.identify(shardId); }, shardIsReady: async () => { logger.debug(`[Shard] Shard #${shardId} is ready`)