Skip to content

Commit 9764e50

Browse files
committed
Bump package.json version to 1.8.7 and update disconnect event handler in Cluster class
1 parent 6e1aaa5 commit 9764e50

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.8.6",
2+
"version": "1.8.7",
33
"name": "status-sharding",
44
"author": "Digital39999",
55
"scripts": {

src/core/cluster.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class Cluster<
131131
this.messageHandler = new ClusterHandler(this, this.thread);
132132

133133
const thread = this.thread.spawn();
134-
thread.on('disconnect', this._handleExit.bind(this));
134+
thread.on('disconnect', this._handleDisconnect.bind(this));
135135
thread.on('message', this._handleMessage.bind(this));
136136
thread.on('error', this._handleError.bind(this));
137137
thread.on('exit', this._handleExit.bind(this));
@@ -407,6 +407,11 @@ export class Cluster<
407407
this.thread = null;
408408
}
409409

410+
private _handleDisconnect(): void {
411+
this.emit('disconnect', this, this.thread?.process);
412+
this.manager._debug('[Death] [Cluster ' + this.id + '] Cluster disconnected.');
413+
}
414+
410415
/**
411416
* Error handler function that handles errors from the cluster's child process/worker/manager.
412417
* @private

0 commit comments

Comments
 (0)