fix cron, add pilot time server update

This commit is contained in:
PxlLoewe
2025-06-02 14:24:37 -07:00
parent 9028eb9c71
commit 72998a36a4
6 changed files with 57 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
import { MissionLog, prisma } from "@repo/db";
import chron from "cron";
import cron from "node-cron";
const removeClosedMissions = async () => {
const oldMissions = await prisma.mission.findMany({
@@ -40,12 +40,10 @@ const removeClosedMissions = async () => {
});
};
const removeClosedMissionsJob = new chron.CronJob(
"*/5 * * * *", // Every 5 minutes
removeClosedMissions,
null,
true,
"Europe/Berlin",
);
removeClosedMissionsJob.start();
cron.schedule("*/5 * * * *", async () => {
try {
await removeClosedMissions();
} catch (error) {
console.error("Error removing closed missions:", error);
}
});

View File

@@ -32,6 +32,7 @@
"express": "^5.1.0",
"jsonwebtoken": "^9.0.2",
"livekit-server-sdk": "^2.13.0",
"node-cron": "^4.1.0",
"nodemailer": "^7.0.3",
"nodemon": "^3.1.10",
"react": "^19.1.0",

View File

@@ -68,7 +68,6 @@ export const handleConnectPilot =
posH145active: true,
},
});
socket.join("dispatchers"); // Join the dispatchers room
socket.join(`user:${userId}`); // Join the user-specific room
socket.join(`station:${stationId}`); // Join the station-specific room