MCPcopy Index your code
hub / github.com/simstudioai/sim / dispatchInProcess

Function dispatchInProcess

apps/sim/lib/knowledge/documents/service.ts:474–490  ·  view source on GitHub ↗
(
  jobPayloads: DocumentProcessingPayload[],
  requestId: string
)

Source from the content-addressed store, hash-verified

472}
473
474async function dispatchInProcess(
475 jobPayloads: DocumentProcessingPayload[],
476 requestId: string
477): Promise<number> {
478 const results = await Promise.allSettled(
479 jobPayloads.map((p) =>
480 processDocumentAsync(p.knowledgeBaseId, p.documentId, p.docData, p.processingOptions)
481 )
482 )
483 let dispatched = 0
484 for (const r of results) {
485 if (r.status === 'fulfilled') dispatched++
486 else
487 logger.error(`[${requestId}] Document dispatch failed`, { error: getErrorMessage(r.reason) })
488 }
489 return dispatched
490}
491
492export async function processDocumentAsync(
493 knowledgeBaseId: string,

Callers 1

Calls 3

getErrorMessageFunction · 0.90
processDocumentAsyncFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected