Read each schedule's production status once a minute

Every content schedule row on the Schedule page asked the engine for its
production status every 5s while a plan was running, a steady stream of
/content requests during production. Read it once a minute; starting a
production still refreshes it at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Iqbal
2026-10-29 17:20:43 +07:00
parent 6ac8692d0d
commit ebfd3802c6

View File

@@ -151,11 +151,13 @@ function ScheduleRow({ schedule, owners }: { schedule: Schedule; owners?: Owners
) )
} }
// Content schedules report this week's progress from the engine's production period. // Content schedules report this week's progress from the engine's production period. Each row
// asks for its own, so it is read once a minute; starting a production refreshes it at once.
const useProduction = (agentId: number) => useQuery({ const useProduction = (agentId: number) => useQuery({
queryKey: ['production', agentId], queryKey: ['production', agentId],
queryFn: () => productionStatus(agentId), queryFn: () => productionStatus(agentId),
refetchInterval: q => (q.state.data?.plans.some(p => PLAN_ACTIVE.has(p.status)) ? 5000 : 60_000), refetchInterval: 60_000,
staleTime: 60_000,
}) })
function ProductionLine({ agentId, active }: { agentId: number; active: boolean }) { function ProductionLine({ agentId, active }: { agentId: number; active: boolean }) {