logic
logic
DIAdiscord.js - Imagine an app
Created by logic on 11/18/2024 in #djs-questions
Memory leak when sharding
dev bot without sharding = ~150 mb dev bot with sharding = 490 mb at start and climbs rapidly without stabilizing prod bot without sharding = (cant because its above 2500) prod bot with sharding = 2000 mb at start and climbs without stabilizing
8 replies
DIAdiscord.js - Imagine an app
Created by logic on 11/18/2024 in #djs-questions
Memory leak when sharding
Lmk what other files i should send
8 replies
DIAdiscord.js - Imagine an app
Created by logic on 11/18/2024 in #djs-questions
Memory leak when sharding
Cluster.ts
import { ShardingManager } from "discord.js";
import config from "./models/Config";

const manager = new ShardingManager(`${__dirname}/bot.js`, {
token: config.token,
totalShards: "auto"
});

manager.on('shardCreate', shard => {
console.log(`[SHARD ${shard.id}]: Launched`);
shard.on("ready", async () => {
console.log(`[SHARD ${shard.id}]: Ready`);
});
});

manager.spawn({ timeout: -1 })
.catch(console.error);
import { ShardingManager } from "discord.js";
import config from "./models/Config";

const manager = new ShardingManager(`${__dirname}/bot.js`, {
token: config.token,
totalShards: "auto"
});

manager.on('shardCreate', shard => {
console.log(`[SHARD ${shard.id}]: Launched`);
shard.on("ready", async () => {
console.log(`[SHARD ${shard.id}]: Ready`);
});
});

manager.spawn({ timeout: -1 })
.catch(console.error);
8 replies