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:
Iqbal
2026-10-29 17:12:51 +07:00
parent 3478d28bb2
commit 6ac8692d0d
3 changed files with 9 additions and 5 deletions

View File

@@ -201,6 +201,11 @@ export async function settleLimited<T, R>(items: T[], limit: number, fn: (item:
const PER_SCHEDULE_LIMIT = 4
// Results cost one request per schedule (every video schedule's drafts), so they are read once a
// minute, and a page opened or refocused within that minute reuses what was read. An action on a
// result or schedule still refreshes them at once.
export const RESULTS_POLL = { refetchInterval: 60_000, staleTime: 60_000 }
export async function listResults(): Promise<{ materials: Material[]; sources: FoundSource[] }> {
const schedules = await expressAgents({ archived: true })
const content = schedules.filter(s => s.rule.type === 'content')