Improvements to the queue processing.

This commit is contained in:
2025-12-16 00:49:35 +00:00
parent f0c35eef0e
commit e52f3284ba
9 changed files with 202 additions and 39 deletions
+13 -1
View File
@@ -1,12 +1,16 @@
import { ref, onMounted, onUnmounted } from 'vue'
import { ref, onMounted, onUnmounted, watch } from 'vue'
import type { Stats } from '@/types'
import { fetchStats } from '@/utils/api'
import { useSSE } from './useSSE'
export function useStats(pollInterval: number = 5000) {
const stats = ref<Stats | null>(null)
const loading = ref(false)
const error = ref<string | null>(null)
// SSE for real-time session updates
const { lastEvent } = useSSE()
let intervalId: number | null = null
const refresh = async () => {
@@ -35,6 +39,14 @@ export function useStats(pollInterval: number = 5000) {
}
}
// Watch for SSE session events and refresh immediately
watch(lastEvent, (event) => {
if (event && event.type === 'session') {
console.log('[Stats] SSE session event triggered refresh:', event.action)
refresh()
}
})
onMounted(() => {
refresh()
startPolling()