This commit is contained in:
Andras Schmelczer 2025-11-18 22:26:53 +00:00
parent 0736047487
commit 7bb7765c84
2 changed files with 9 additions and 5 deletions

View file

@ -143,7 +143,9 @@ async function main(): Promise<void> {
writeHealthStatus(healthFile, status);
});
}, 30 * 1000); // every 30 seconds
const clearHealthInterval = () => clearInterval(healthInterval);
const clearHealthInterval = (): void => {
clearInterval(healthInterval);
};
process.on("SIGINT", clearHealthInterval);
process.on("SIGTERM", clearHealthInterval);
process.on("exit", clearHealthInterval);

View file

@ -13,11 +13,13 @@ function isHealthStatus(value: unknown): value is NetworkConnectionStatus {
return false;
}
const obj = value as Record<string, unknown>;
return (
typeof obj.isSuccessful === "boolean" &&
typeof obj.isWebSocketConnected === "boolean" &&
typeof obj.serverMessage === "string"
"isSuccessful" in value &&
typeof value.isSuccessful === "boolean" &&
"isWebSocketConnected" in value &&
typeof value.isWebSocketConnected === "boolean" &&
"serverMessage" in value &&
typeof value.serverMessage === "string"
);
}