diff --git a/src/index.ts b/src/index.ts index 7af6dbe..737f191 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,6 +31,12 @@ app.get("/active_sessions", async (req, res) => { res.json(activeSessions); }); +app.get("/builds", async (req, res) => { + const builds = await Build.find(); + + res.json(builds); +}); + app.get("/start", async (req, res) => { const location = req.query.location as string; const buildName = req.query.build as string; @@ -207,7 +213,7 @@ async function checkActiveSessions() { if ( !activeSession.endAt && !activeSession.connectedPlayersCount && - differenceInMinutes(new Date(), activeSession.updatedAt) > 2 + differenceInMinutes(new Date(), activeSession.updatedAt) >= 3 ) { const activeSessionId = activeSession.id; @@ -284,10 +290,10 @@ async function checkScheduledSessions() { } } -cron.schedule("* * * * *", () => { +cron.schedule("* * * * * *", () => { checkActiveSessions(); }); -cron.schedule("* * * * *", () => { +cron.schedule("* * * * * *", () => { checkScheduledSessions(); });