Skip to content

Commit 543f622

Browse files
Archish27francisf
authored andcommitted
🐛 fix for disconnecting workers
1 parent 73e4be6 commit 543f622

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

cluster.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,11 @@ if (cluster.isMaster) {
6666
}
6767
});
6868
} else {
69-
new Proxy();
69+
const proxy = new Proxy();
70+
cluster.worker.on('disconnect', () => {
71+
proxy.httpServer.close(() => {
72+
logger.info(`Worker stopping ${process.pid}`);
73+
process.exit(0);
74+
});
75+
});
7076
}

lib/core/IncomingWebSocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class IncomingWebSocket extends EventEmitter {
132132
/**
133133
* Relays ping from upstream.
134134
*/
135-
ping() {
135+
ping() {
136136
this.socket.ping();
137137
}
138138
}

lib/util/AlertManager.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const logger = require('./loggerFactory');
44
* Sends alert information.
55
*/
66
class AlertManager {
7-
87
/**
98
* Creates the AlertManager.
109
*/
@@ -21,9 +20,7 @@ class AlertManager {
2120
* @param {String} message
2221
*/
2322
sendAlerts(subject, message) {
24-
logger.info(
25-
`Alert with subject: ${subject} message: ${message}`
26-
);
23+
logger.info(`Alert with subject: ${subject} message: ${message}`);
2724
}
2825
}
2926

0 commit comments

Comments
 (0)