mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-05-24 15:08:39 -05:00
Added sendCurrent, sendError & sendRunning to the healthchecks task
This commit is contained in:
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user