Added sendCurrent, sendError & sendRunning to the healthchecks task

This commit is contained in:
Mathias Wagner
2022-08-28 22:53:43 +02:00
parent e471f19358
commit eb1a3ad150
+15
View File
@@ -29,4 +29,19 @@ module.exports.sendPing = async (path, message) => {
} catch (e) {
console.error("Could not send ping: " + e.message);
}
}
// Sends a ping only if the ping state is active
module.exports.sendCurrent = async () => {
if (currentState === "ping") await this.sendPing();
}
// Sends an error to the healthcheck server
module.exports.sendError = async (error = "Unknown error") => {
await this.sendPing("fail", error);
}
// Sends a 'running' ping to the healthcheck server
module.exports.sendRunning = async () => {
await this.sendPing("start");
}