Skip to content

Commit

Permalink
Add healthcheck endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Philenst committed Sep 26, 2024
1 parent 85d15bf commit 69ab60f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ export const fetchRate = 60 //minutes between each fetch
export const host = "127.0.0.1" //use 0.0.0.0 as alternative
export const port = 2345
export const trackerWebhook = ""
export const trackerUpdateWebhook = ""
export const trackerUpdateWebhook = ""
export const healthCheckEndpoint = ""
5 changes: 4 additions & 1 deletion modules/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fetchRate } from "../config.js";
import database from "../helper/database.js";
import { getUser, fillCache, updated } from "./fetch.js";
import Logger from "cutesy.js"
import { trackerUpdateWebhook } from "../config.js";
import { trackerUpdateWebhook, healthCheckEndpoint } from "../config.js";
import { WebhookClient, EmbedBuilder } from 'discord.js'
const webhookClient = new WebhookClient({ url: trackerUpdateWebhook })
const logger = new Logger().addTimestamp("hh:mm:ss").changeTag("Fetch").purple()
Expand Down Expand Up @@ -42,6 +42,9 @@ function update(){
updated.scores = 0;
logger.send("Finished update.")
locked = false;
if (healthCheckEndpoint) {
await fetch(healthCheckEndpoint)
}
return resolve()
})
}
Expand Down

0 comments on commit 69ab60f

Please sign in to comment.