fix: final shard bug not starting up

This commit is contained in:
Skillz4Killz
2022-05-18 18:32:47 +00:00
committed by GitHub
parent a920c2be1b
commit 85acfd4c2e
+3 -2
View File
@@ -12,7 +12,7 @@ export function prepareBuckets(gateway: GatewayManager, firstShardId: number, la
}
// ORGANIZE ALL SHARDS INTO THEIR OWN BUCKETS
for (let i = firstShardId; i < lastShardId; i++) {
for (let i = firstShardId; i <= lastShardId; i++) {
gateway.debug("GW DEBUG", `1. Running for loop in spawnShards function for shardId ${i}.`);
if (i >= gateway.maxShards) {
continue;
@@ -45,8 +45,9 @@ export function spawnShards(gateway: GatewayManager, firstShardId = 0) {
}
// PREPARES ALL SHARDS IN SPECIFIC BUCKETS
prepareBuckets(gateway, firstShardId, gateway.lastShardId ? gateway.lastShardId : gateway.maxShards);
prepareBuckets(gateway, firstShardId, gateway.lastShardId ? gateway.lastShardId : gateway.maxShards - 1);
console.log(gateway.buckets.first());
// SPREAD THIS OUT TO DIFFERENT WORKERS TO BEGIN STARTING UP
gateway.buckets.forEach(async (bucket, bucketId) => {
gateway.debug("GW DEBUG", `2. Running forEach loop in spawnShards function.`);