/** * Next.js instrumentation hook — runs once when the server starts. * Used to kick off the background stats poller so alerts are generated * and Discord notifications are sent even when no client is connected. */ export async function register() { // Only run in the Node.js runtime (not Edge). // better-sqlite3 and the fetch clients require Node.js APIs. if (process.env.NEXT_RUNTIME === "edge") return; const { startBackgroundPoller } = await import("@/lib/statsBuilder"); startBackgroundPoller(); }