mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
make shardmanager better (#731)
* add respawn thing for shards, and make it easier to recieve messages from shards * run docs
This commit is contained in:
@@ -27,6 +27,14 @@ class Shard {
|
||||
* @type {ChildProcess}
|
||||
*/
|
||||
this.process = childProcess.fork(path.resolve(this.manager.file), [id, this.manager.shards.size]);
|
||||
|
||||
this.process.once('exit', () => {
|
||||
if (this.manager.respawn) this.manager.createShard(this.id);
|
||||
});
|
||||
|
||||
this.process.on('message', message => {
|
||||
this.manager.emit('message', this, message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user