import { cleanupService } from "./cleanup.service"; import { config } from "@/lib/config"; /** * The Scheduler responsible for periodic tasks and system maintenance. */ export const schedulerService = { start: () => { console.log("🕒 Scheduler started: Maintenance loops initialized."); // 1. High-frequency timer cleanup (every 60s) // This handles role revocations and cooldown expirations setInterval(() => { cleanupService.cleanupTimers(); }, 60 * 1000); // 2. Scheduled system cleanup (configurable, default daily) // This handles lootdrops, quests, etc. setInterval(() => { cleanupService.runAll(); }, config.system.cleanup.intervalMs); // 3. Terminal Update Loop (every 60s) const { terminalService } = require("@/modules/terminal/terminal.service"); setInterval(() => { terminalService.update(); }, 60 * 1000); // Run an initial cleanup on start for good measure cleanupService.runAll(); } };