Shards

how does sharding work: one shard can have many processes? or one process can have many shards? or one shard has only one process?
const manager = new ShardingManager('./xmain.js', { token: process.env.BOT_TOKEN });

manager.on('shardCreate', shard => {
console.log(`Launched shard ${shard.id}`);
});

manager.spawn();
const manager = new ShardingManager('./xmain.js', { token: process.env.BOT_TOKEN });

manager.on('shardCreate', shard => {
console.log(`Launched shard ${shard.id}`);
});

manager.spawn();
that's what im using
5 Replies
d.js toolkit
d.js toolkit•7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
mallusrgreat
mallusrgreat•7mo ago
one process can have many shards
space
space•7mo ago
The default using the sharding manager is to have one manager / parent process and then one child process per shard.
Lawa
Lawa•7mo ago
so when i return bot.shard.ids mostly ill only get one shard per process by default
space
space•7mo ago
Yes
Want results from more Discord servers?
Add your server