import { getStats } from "../../service/scheduler"; import { getJobCount } from "../../scheduler/engine"; export default defineWrappedResponseHandler(async () => { const cacheKey = 'scheduler:stats' const cached = await event.context.cache.get<{ totalTasks: number, enabledTasks: number, last24hExecutions: number, activeJobs: number }>(cacheKey) if (cached) return R.success({ ...cached, activeJobs: getJobCount() }) const stats = await getStats(); const result = { ...stats, activeJobs: getJobCount() } await event.context.cache.set(cacheKey, result, 60) return R.success(result); });