How to kill a shard and prevent its auto respawn functionnality?
Hello,
I m using the ShardingManager and I want to know how to prevent the shards you kill with shard.kill() to automatically respawn after it? Without restarting the ShardingManager.
6 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!
- โ
Marked as resolved by OPThe goal is that when my API asks the manager to stop a shard it stops it
Actually I have that as the code :
:propertysignature: ShardingManagerOptions#respawn
@14.16.1
Whether shards should automatically respawn upon exitingbut when I kill one the shardingManager respawns it
Yooo
thanks
As I am using multiple servers to host my bot, there are multiple shardingManager working together
but
discord.js is not made for this
it's made for only one execution of a shardingManager
and so it's possible that when restarting the shardingManager simultaneously that some of them takes the same shard and so a shard could be launched 2 times
Yep but
the problem is that
if one shardingManager shutdown
the shards are stopped and these shards are abandonned
so the servers on these shards cannot access the bot anymore ?
Well, you need to have an intermediate between the shardingManagers right ?
So that if one's down we can restart another
Maybe I m doing this wrong, I don't know
You're right for that
But I think that the difference and the thing I didn't told you is that all shardingManager have a number of max shards they can handle but I don't want them to use this max number by default, only when it's necessary. So my API tells to the shardingManagers that are avaialable to receive a shard to launch a shard. But, if we reload the API, it doesn't know which ones are started so it gets all the shards already launched and at this moment others shardingManager could take shards that are already launched somewhere else and so if a manager tries to start a shard that is already launched the API tells him to stop
well
by writing this I m thinking that maybe there's something to do to prevent launching shards before getting already launched shards but not sure how to do that
any ways thanks for your help