mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
fix: use private close clode
This commit is contained in:
@@ -16,14 +16,7 @@ export async function createShard(shardId: number) {
|
||||
|
||||
socket.onclose = (event) => {
|
||||
ws.log("CLOSED", { shardId, payload: event });
|
||||
if (
|
||||
event.code === 4009 &&
|
||||
["Resharded!", "Resuming the shard, closing old shard."].includes(
|
||||
event.reason,
|
||||
)
|
||||
) {
|
||||
return ws.log("CLOSED_RECONNECT", { shardId, payload: event });
|
||||
}
|
||||
|
||||
if (
|
||||
event.code === 3064 ||
|
||||
event.reason === "Discordeno Testing Finished! Do Not RESUME!"
|
||||
@@ -31,6 +24,15 @@ export async function createShard(shardId: number) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
event.code === 3065 ||
|
||||
["Resharded!", "Resuming the shard, closing old shard."].includes(
|
||||
event.reason,
|
||||
)
|
||||
) {
|
||||
return ws.log("CLOSED_RECONNECT", { shardId, payload: event });
|
||||
}
|
||||
|
||||
// TODO: ENUM FOR THESE CODES?
|
||||
switch (event.code) {
|
||||
case 4001:
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function resume(shardId: number) {
|
||||
|
||||
if (oldShard) {
|
||||
// HOW TO CLOSE OLD SHARD SOCKET!!!
|
||||
oldShard.ws.close(4009, "Resuming the shard, closing old shard.");
|
||||
oldShard.ws.close(3065, "Resuming the shard, closing old shard.");
|
||||
// STOP OLD HEARTBEAT
|
||||
clearInterval(oldShard.heartbeat.intervalId);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ export async function tellClusterToIdentify(
|
||||
await ws.identify(shardId, ws.maxShards);
|
||||
|
||||
if (oldShard) {
|
||||
oldShard.ws.close(4009, "Resharded!");
|
||||
oldShard.ws.close(3065, "Resharded!");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user