Read results once a minute
Every read of results asks each video schedule for its drafts, and the dashboard read them every 10s while anything was being made, so the network tab filled with video-drafts requests. Poll once a minute on the dashboard and Results page, and reuse a read under a minute old when a page opens or regains focus. Actions still refresh results at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import { Icon } from '../components/Icon'
|
||||
import { PageHead, Skeleton, SkeletonCards } from '../components/Page'
|
||||
import { buildGraph, CLUSTERS, type Cluster, type Graph, type GraphNode } from '../express/graph'
|
||||
import { describeRule } from '../express/parse'
|
||||
import { isWorking, listResults, materialKey, titleOf, type Material } from '../express/results'
|
||||
import { isWorking, listResults, materialKey, RESULTS_POLL, titleOf, type Material } from '../express/results'
|
||||
import { listSchedules } from '../express/schedules'
|
||||
import { locale, t, type Key } from '../i18n'
|
||||
import { ContentCard, Preview } from './Results'
|
||||
@@ -54,8 +54,7 @@ export function ProductionPage() {
|
||||
const results = useQuery({
|
||||
queryKey: ['results'],
|
||||
queryFn: listResults,
|
||||
// Polled more often than on Results so a run that just started shows up under content in progress.
|
||||
refetchInterval: q => (q.state.data?.materials.some(isWorking) ? 10_000 : 20_000),
|
||||
...RESULTS_POLL,
|
||||
})
|
||||
const schedules = useQuery({ queryKey: ['schedules'], queryFn: listSchedules, refetchInterval: 30_000 })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user