status-sharding cluster died
Hello, so my bot is up and running fine but every now an then I get this in my console and I have to restart my bot..
LOG [SYSTEM] [ClusterID: 0] died
This is my code:
How can I prevent it / is it possible to "revive" the dead cluster on cluster death?26 Replies
1. your code somehow crashes the cluster by exiting the process
2. to add logs for that, you can setup this (image below) in your main and cluster files, so it tells you the issue instead of dying
3. yes, you can use heartbeat system, by passing in
heartbeat: { enabled: true } in manager options
Cant I do something like this?
or will this not work:
you can, instead of 3rd note, but i still suggest you to prevent crashing of clusters as said in 2nd note
well the thing is I had the thing you mentioned in step 2 already implemented and no error was showing.
I just saw random in my console today
LOG [SYSTEM] [ClusterID: 0] died
well that will prevent it dying next time it wants to
so what would you do.
would wou still implement process.on("warning")?
well i screenshoted my code above, so, it doesnt hurt to have
wait you said in your "main and cluster" files.?
I only have this (image)
in my main file.
I start from index.js (where the image is)
and there it calls bot.js the actual bot file
your bot.js file crashes, just put those 3 in both files, like at the bottom
or at the top
ok ill try that
but in any case this will work right?
yes, but difference between that and those 3 lines from my ss is that my 3 lines will prevent death from even happening
tru
wait I am dumb tho
i have those as well?

put them fully outside of any function, and copy them over to bot.js file too
okay ty
so with these startup files:
index.js: https://sourceb.in/zxi1sRWmfG
bot.js: https://sourceb.in/wMxyNcdZEW
the bot just crashed after 2d, 14h.
This is what I seein the console:

hm weird
that error is when sharding couldnt find the process to terminate on restart
any suggestions on what I could do to fix it?
im not sure, i run the same much bigger codebases on it and i never had such issues
what's your Client
its a custom class from which extends status-sharding
https://sourceb.in/pYEitfiILS
my only guess would be that you tripple check that you dont somewhere import a file that is used by manager into client or vice versa, ei:
- this below will fail, or if you import Lunio client in some file that manager uses
client.js:
functions.js:
manager:
okay thanks ill check for that then
Does "status-sharding" support this?
https://discordjs.guide/miscellaneous/cache-customization.html#sweeping-caches
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
yes if course, we dont interfere with discord.js
new ShardingClient({ .... })
okay thanks