import { Router } from 'express'; import { asyncWrap } from '../errors.js'; import { storageHealth } from '../../proxmox/storage.js'; // Read-only storage/capacity health for the Sacred Valley card. Cached briefly so // multiple polling clients coalesce into one set of PVE calls. Owner or any authed agent. export const router = Router(); let cache = { at: 0, data: null }; const TTL = 15_000; router.get('/', asyncWrap(async (_req, res) => { if (cache.data && Date.now() - cache.at < TTL) return res.json(cache.data); const data = await storageHealth(); cache = { at: Date.now(), data }; res.json(data); }));