This commit is contained in:
Erik 2023-02-06 14:33:27 +02:00
parent 3985571a96
commit c271c05b0d
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -38,7 +38,7 @@ class Shard extends EventEmitter {
this.process = ChildProcess.fork(this.filePath, this.args, { env: { ...this.env, SHARD_ID: this.id }, execArgv: this.execArgv })
.on('message', this._handleMessage.bind(this))
.on('exit', this._handleExit().bind(this))
.on('exit', this._handleExit.bind(this))
.on('disconnect', this._handleDisconnect.bind(this)); // Don't know if this is going to help, but monitoring whether this gets called whenever a process on its own closes the IPC channel
this.process.once('spawn', () => {
@ -136,7 +136,7 @@ class Shard extends EventEmitter {
}
_handleExit (code, signal, respawn = this._respawn) {
this.process.removeAllListeners();
if (this.process) this.process.removeAllListeners();
this.emit('death');
if (code !== 0) this.crashes.push(Date.now() - this.spawnedAt);