Skip to content

Commit

Permalink
Add match count to status
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkView committed Dec 23, 2024
1 parent a4d4d73 commit 610d28c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/controller/MatchController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export class MatchController {
}
}

getMatchCount() {
return Object.keys(this.matches).length;
}

async receiveMatchData(data: IAuthedData) {
if (data.timestamp == null) {
data.timestamp = Date.now();
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { WebsocketIncoming } from "./connector/websocketIncoming";
import express from "express";
import logging from "./util/Logging";
import { MatchController } from "./controller/MatchController";
const Log = logging("Status");

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -10,7 +11,8 @@ const app = express();
const port = 5101;

app.get("/status", (req, res) => {
res.json({ status: "UP" });
const status = { status: "UP", matchesRunning: MatchController.getInstance().getMatchCount() };
res.json(status);
});

app.listen(port, () => {
Expand Down

0 comments on commit 610d28c

Please sign in to comment.