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

Method triggerPull

packages/sync/src/pull-engine.ts:500–529  ·  view source on GitHub ↗
(sourceId: string, sessionId?: string)

Source from the content-addressed store, hash-verified

498 }
499
500 async triggerPull(sourceId: string, sessionId?: string): Promise<{ success: boolean; error?: string }> {
501 const ds = this.dsManager.get(sourceId)
502 if (!ds) return { success: false, error: 'Data source not found' }
503
504 if (sessionId) {
505 const sess = ds.sessions.find((s) => s.id === sessionId)
506 if (!sess) return { success: false, error: 'Session not found' }
507 const result = await this.executePullSession(sourceId, ds, sess)
508 return { success: result.success, error: result.error }
509 }
510
511 if (this.pullingSourceIds.has(sourceId)) {
512 this.logger.info(`[Pull] Skipping triggerPull for source ${sourceId}: pull already in progress`)
513 return { success: true }
514 }
515 this.pullingSourceIds.add(sourceId)
516 try {
517 const errors: string[] = []
518 for (const sess of ds.sessions) {
519 const result = await this.executePullSession(sourceId, ds, sess)
520 if (!result.success && result.error) errors.push(`${sess.name}: ${result.error}`)
521 }
522 if (errors.length > 0) {
523 return { success: false, error: errors.join('; ') }
524 }
525 return { success: true }
526 } finally {
527 this.pullingSourceIds.delete(sourceId)
528 }
529 }
530
531 async triggerPullAll(sourceId: string): Promise<{ success: boolean; error?: string }> {
532 return this.triggerPull(sourceId)

Callers 1

triggerPullAllMethod · 0.95

Calls 5

executePullSessionMethod · 0.95
getMethod · 0.65
infoMethod · 0.65
deleteMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected