From c9be91a967167e11ceca286fba531f7ae297f5d1 Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Thu, 16 Dec 2021 15:57:26 +0000 Subject: [PATCH] fix: load order bug --- src/ws/spawnShards.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ws/spawnShards.ts b/src/ws/spawnShards.ts index 860832c20..64e24da42 100644 --- a/src/ws/spawnShards.ts +++ b/src/ws/spawnShards.ts @@ -42,13 +42,12 @@ export function spawnShards(gateway: GatewayManager, firstShardId = 0) { for (const [workerId, ...queue] of bucket.workers) { gateway.debug(`3. Running for of loop in spawnShards function.`); - queue.forEach((shardId) => { + for (const shardId of queue) { bucket.createNextShard.push(async () => { await gateway.tellWorkerToIdentify(gateway, workerId, shardId, bucketId); }); - }); - - await bucket.createNextShard.shift()?.(); + } } + await bucket.createNextShard.shift()?.(); }); }