This commit is contained in:
2024-10-16 18:00:26 +05:00
parent c733675cbc
commit 847cb7983a
+9 -3
View File
@@ -31,6 +31,12 @@ app.get("/active_sessions", async (req, res) => {
res.json(activeSessions); res.json(activeSessions);
}); });
app.get("/builds", async (req, res) => {
const builds = await Build.find();
res.json(builds);
});
app.get("/start", async (req, res) => { app.get("/start", async (req, res) => {
const location = req.query.location as string; const location = req.query.location as string;
const buildName = req.query.build as string; const buildName = req.query.build as string;
@@ -207,7 +213,7 @@ async function checkActiveSessions() {
if ( if (
!activeSession.endAt && !activeSession.endAt &&
!activeSession.connectedPlayersCount && !activeSession.connectedPlayersCount &&
differenceInMinutes(new Date(), activeSession.updatedAt) > 2 differenceInMinutes(new Date(), activeSession.updatedAt) >= 3
) { ) {
const activeSessionId = activeSession.id; const activeSessionId = activeSession.id;
@@ -284,10 +290,10 @@ async function checkScheduledSessions() {
} }
} }
cron.schedule("* * * * *", () => { cron.schedule("* * * * * *", () => {
checkActiveSessions(); checkActiveSessions();
}); });
cron.schedule("* * * * *", () => { cron.schedule("* * * * * *", () => {
checkScheduledSessions(); checkScheduledSessions();
}); });