#Check DiscordJS internal websocket health

8 messages · Page 1 of 1 (latest)

boreal igloo
#

As per the linked issue, Discordjs seems to randomly fumble the Discord API websocket reacquisition, causing the bot to become a zombie process. To fix this, a user has to either manually observe the bot being offline and restart the process, or implement an external health check to check that the bot is online.

Is there a way to do this internally? IE within the bot application, poll the DiscordJS library's websocket status to determine if the process needs to be restarted?

https://github.com/discordjs/discord.js/issues/8486

GitHub

Which package is this bug report for? discord.js Issue description After around 5-6 hours of running, my discord bot decides to randomly exit with an exit code of 0. There is nothing in my code tha...

tacit ploverBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

boreal igloo
echo dawn
#

If the ws ping is the same for like, 3 minutes, kill the process

#

Idk

#

Or to check how much the bot has restarted in X minutes

boreal igloo
#

I did some digging and yeah, it looks like the only way to determine the websocket health is to check if the ping is remaining the same, optimally with an inverse backoff loop to rule out false positives. If the ping has remained the same after X checks or for Y seconds, then restart the entire bot application