mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
fix: move createNextShard to ws
This commit is contained in:
@@ -5,10 +5,10 @@ import { structures } from "../../structures/mod.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import { DiscordReady } from "../../types/gateway/ready.ts";
|
||||
import { DiscordGuildMemberWithUser } from "../../types/mod.ts";
|
||||
import { camelKeysToSnakeCase, delay } from "../../util/utils.ts";
|
||||
import { camelKeysToSnakeCase } from "../../util/utils.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
export async function handleReady(
|
||||
export function handleReady(
|
||||
data: DiscordGatewayPayload,
|
||||
shardId: number,
|
||||
) {
|
||||
@@ -40,10 +40,6 @@ export async function handleReady(
|
||||
);
|
||||
await checkReady(payload, shardId, now);
|
||||
}, 2000);
|
||||
|
||||
// Wait 5 seconds to spawn next shard
|
||||
await delay(5000);
|
||||
ws.createNextShard = true;
|
||||
}
|
||||
|
||||
// Don't pass the shard itself because unavailableGuilds won't be updated by the GUILD_CREATE event
|
||||
|
||||
@@ -4,6 +4,7 @@ import { DiscordGatewayOpcodes } from "../types/codes/gateway_opcodes.ts";
|
||||
import { DiscordGatewayPayload } from "../types/gateway/gateway_payload.ts";
|
||||
import { DiscordHello } from "../types/gateway/hello.ts";
|
||||
import { DiscordReady } from "../types/gateway/ready.ts";
|
||||
import { delay } from "../util/utils.ts";
|
||||
import { decompressWith } from "./deps.ts";
|
||||
import { identify } from "./identify.ts";
|
||||
import { resume } from "./resume.ts";
|
||||
@@ -96,6 +97,10 @@ export async function handleOnMessage(message: any, shardId: number) {
|
||||
|
||||
ws.loadingShards.get(shardId)?.resolve(true);
|
||||
ws.loadingShards.delete(shardId);
|
||||
// Wait 5 seconds to spawn next shard
|
||||
setTimeout(() => {
|
||||
ws.createNextShard = true;
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// Update the sequence number if it is present
|
||||
|
||||
Reference in New Issue
Block a user