Files
discordeno/gateway/manager/spawnShards.ts
Skillz4Killz d2af3ae896 fix: cleanup
2022-08-31 16:18:51 +00:00

17 lines
516 B
TypeScript

import { GatewayManager } from "./gatewayManager.ts";
/** Begin spawning shards. */
export function spawnShards(gateway: GatewayManager) {
// PREPARES ALL SHARDS IN SPECIFIC BUCKETS
gateway.prepareBuckets();
// SPREAD THIS OUT TO DIFFERENT WORKERS TO BEGIN STARTING UP
gateway.buckets.forEach(async (bucket, bucketId) => {
for (const worker of bucket.workers) {
for (const shardId of worker.queue) {
await gateway.tellWorkerToIdentify(worker.id, shardId, bucketId);
}
}
});
}