What happens at 2,500 guilds/shard if you don't automatically reshard

What happens if a shard exceeds its maximum number of guilds? Does that shard crash (due to discord disconnecting the gateway client and it not being allowed to reconnect any longer), or does the entire parent process exit as well (allowing an automatic restart to properly reshard as a fallback without duplicate/orphan processes running)
15 Replies
d.js toolkit
d.js toolkit2mo 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!
monbrey
monbrey2mo ago
It doesnt though
nick.
nick.OP2mo ago
wdym by this? does djs automatically handle resharding? i've seen mixed info on this
monbrey
monbrey2mo ago
Discord wont allocate more guilds to shards The question I think then is what the behaviour is for an unhandled new shard?
nick.
nick.OP2mo ago
wdym by this, because if say you have 3 shards running and a new guild gets invited, of course one of those shards has to handle it
monbrey
monbrey2mo ago
No, unless I'm mistaken Discord wont assign that guild to a shard if it would exceed 2500
nick.
nick.OP2mo ago
the question is what happens if say you have 2 shards running and your bot exceeds 5,000 servers (or 2,500 servers on any one shard), does a shard die or does the parent process die
Mark
Mark2mo ago
I thought it would and that the shard count only mattered when starting the bot
nick.
nick.OP2mo ago
oh really? didn't know that
monbrey
monbrey2mo ago
I thought it was Discord enforced, idk Time to research!
nick.
nick.OP2mo ago
same ahah hmm the gateway page on the docs don't seem to clarify
Each shard can only support a maximum of 2500 guilds, and apps that are in 2500+ guilds must enable sharding.
this is all we get
monbrey
monbrey2mo ago
yeah I thought it was more specific
nick.
nick.OP2mo ago
this is something that could really do with better clarification on discord's end since it's straight up undefined behavior rn
monbrey
monbrey2mo ago
Probably a question to ask in the Discord Developers server
nick.
nick.OP5w ago
yep I suppose to keep this question on topic since I was more interested in discord.js's behavior. If it does turn out to be that discord closes the connection with a 4011, what does discord.js do here, does it try to respawn that shard specifically (which would infinitely fail due to not being a valid num_shards anymore), or does it "reshard" entirely? the shard itself right? that's what i'm expecting, but my question is what does djs do when that error is received, does it try to respawn the shard itself, or does the error bubble up to the sharding manager (which can either handle it, or crash completely) so if it's not true the whole cluster exits? Yeah true. Was just curious what would happen in that case. I did ask in ddevs too but others seem unsure what happens at the gateway level too, whether the connection is allowed to stay open or gets immediately terminated
Want results from more Discord servers?
Add your server