Kill and restart workers when IPC send fails

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
evanpelle
2026-03-13 19:10:27 -07:00
parent e596b998f8
commit 9721aae9ab
+11 -3
View File
@@ -117,10 +117,14 @@ export class MasterLobbyService {
games: this.getAllLobbies(),
},
} satisfies MasterLobbiesBroadcast;
for (const worker of this.workers.values()) {
for (const [workerId, worker] of this.workers.entries()) {
worker.send(msg, (e) => {
if (e) {
this.log.error("Failed to send lobbies broadcast to worker:", e);
this.log.error(
`Failed to send lobbies broadcast to worker ${workerId}, killing worker:`,
e,
);
worker.kill();
}
});
}
@@ -162,7 +166,11 @@ export class MasterLobbyService {
}
worker.send(msg, (e) => {
if (e) {
this.log.error("Failed to send message to worker:", e);
this.log.error(
`Failed to send message to worker ${workerId}, killing worker:`,
e,
);
worker.kill();
}
});
}