Possibly fix weird behaviour

This commit is contained in:
Schuyler Cebulskie
2017-11-20 22:29:46 -05:00
parent c447abad60
commit 527c729aca

View File

@@ -282,17 +282,20 @@ class Shard extends EventEmitter {
* @param {boolean} [respawn=this.manager.respawn] Whether to spawn the shard again * @param {boolean} [respawn=this.manager.respawn] Whether to spawn the shard again
* @private * @private
*/ */
_handleExit(respawn = this.manager.respawn) { _handleExit(respawn) {
if (typeof respawn === 'undefined') respawn = this.manager.respawn;
/** /**
* Emitted upon the shard's child process exiting. * Emitted upon the shard's child process exiting.
* @event Shard#death * @event Shard#death
* @param {ChildProcess} process Child process that exited * @param {ChildProcess} process Child process that exited
*/ */
this.emit('death', this.process); this.emit('death', this.process);
this.ready = false; this.ready = false;
this.process = null; this.process = null;
this._evals.clear(); this._evals.clear();
this._fetches.clear(); this._fetches.clear();
if (respawn) this.spawn().catch(err => this.emit('error', err)); if (respawn) this.spawn().catch(err => this.emit('error', err));
} }
} }