MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / triggerPullAll

Function triggerPullAll

src/stores/apiServer.ts:488–512  ·  view source on GitHub ↗
(sourceId: string)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 7

startProgressPollingFunction · 0.85
fetchDataSourcesFunction · 0.85
generateIndexForSourceFunction · 0.85
triggerPullAllMethod · 0.65
errorMethod · 0.65
deleteMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected