How Can I Restart My Discord Bot Without Downtime? (130k Servers)
My bot is currently in around 130,000 servers, and I'm using Discord.js with sharding to handle them. The problem I'm facing is that whenever I need to restart the bot for updates, it takes around 15 minutes for the bot to be fully online across all servers.
Is there a way to restart my bot without any downtime? I'd really appreciate some guidance on this! Thanks in advance.
4 Replies
- 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!Don't restart the whole process. For small update, such as commands, just reload your commands
Separate the bot from the rest of your architecture (bot connects to your domain through an API) so you can deploy updates without restarting the shards
Maybe deploy a second instance of the bot and add a preprended listener you can turn on manually, when the second instance is 100% running.
Then shut down the 1st instance.
But as said before, if it's only about reloading commands, you can just update them without a restart