(sourceId: string)
| 486 | } |
| 487 | |
| 488 | async function triggerPullAll(sourceId: string) { |
| 489 | const ds = dataSources.value.find((s) => s.id === sourceId) |
| 490 | const ids = [sourceId, ...(ds?.sessions.map((s) => s.id) ?? [])] |
| 491 | for (const id of ids) pullingIds.value.add(id) |
| 492 | pullingIds.value = new Set(pullingIds.value) |
| 493 | const progressTimer = startProgressPolling() |
| 494 | try { |
| 495 | const result = await transport.triggerPullAll(sourceId) |
| 496 | await fetchDataSources() |
| 497 | await useSessionStore().loadSessions() |
| 498 | generateIndexForSource(sourceId) |
| 499 | return result |
| 500 | } catch (err) { |
| 501 | console.error('[ApiServerStore] Failed to trigger pull all:', err) |
| 502 | return { success: false, error: String(err) } |
| 503 | } finally { |
| 504 | clearInterval(progressTimer) |
| 505 | for (const id of ids) { |
| 506 | pullingIds.value.delete(id) |
| 507 | syncProgress.value.delete(id) |
| 508 | } |
| 509 | pullingIds.value = new Set(pullingIds.value) |
| 510 | syncProgress.value = new Map(syncProgress.value) |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | function startProgressPolling(): ReturnType<typeof setInterval> { |
| 515 | return setInterval(fetchSyncProgress, 3000) |
nothing calls this directly
no test coverage detected