Poll run history and processing documents every 5 seconds, not 3

Both are the app's fastest polls; at 5 seconds no read runs more often
than that, which leaves the engine more room when several tabs are open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Iqbal
2026-11-03 12:42:24 +07:00
parent eb194df8e0
commit a3be635648
2 changed files with 2 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ const extOf = (name: string) => '.' + (name.split('.').pop() ?? '').toLowerCase(
export const useDocuments = () => useQuery({ export const useDocuments = () => useQuery({
queryKey: ['documents'], queryKey: ['documents'],
queryFn: listDocuments, queryFn: listDocuments,
refetchInterval: q => (q.state.data?.some(d => phaseOf(d) === 'working') ? 3000 : 20_000), refetchInterval: q => (q.state.data?.some(d => phaseOf(d) === 'working') ? 5000 : 20_000),
}) })
const PHASES: Phase[] = ['ready', 'working', 'answer', 'failed'] const PHASES: Phase[] = ['ready', 'working', 'answer', 'failed']

View File

@@ -265,7 +265,7 @@ function RunHistory({ agentId }: { agentId: number }) {
const runs = useQuery({ const runs = useQuery({
queryKey: ['runs', agentId], queryKey: ['runs', agentId],
queryFn: () => listRuns(agentId), queryFn: () => listRuns(agentId),
refetchInterval: q => (q.state.data?.some(r => ['queued', 'planning', 'running'].includes(r.status)) ? 3000 : false), refetchInterval: q => (q.state.data?.some(r => ['queued', 'planning', 'running'].includes(r.status)) ? 5000 : false),
}) })
if (runs.isPending) return <div className="run-history"><SkeletonLines count={3} label={t('sch.loadingHistory')} /></div> if (runs.isPending) return <div className="run-history"><SkeletonLines count={3} label={t('sch.loadingHistory')} /></div>
if (runs.isError) return <div className="run-history"><span className="error">{runs.error.message}</span></div> if (runs.isError) return <div className="run-history"><span className="error">{runs.error.message}</span></div>