MCPcopy Create free account
hub / github.com/0PandaDEV/Ziit / processWorkChunk

Method processWorkChunk

server/utils/import-queue.ts:472–503  ·  view source on GitHub ↗
(
    chunk: WorkChunk,
    workerId: number,
  )

Source from the content-addressed store, hash-verified

470 }
471
472 private async processWorkChunk(
473 chunk: WorkChunk,
474 workerId: number,
475 ): Promise<void> {
476 try {
477 const jobId = chunk.jobId;
478 const job = activeJobs.get(jobId);
479 if (!job) {
480 handleLog(`Job ${jobId} not found for chunk ${chunk.id}`);
481 return;
482 }
483 if (chunk.type === "date-range" && chunk.data.days) {
484 await this.processDateRangeChunk(chunk, job, workerId);
485 }
486
487 chunk.status = "completed";
488 chunk.progress = 100;
489
490 const completedSet = this.completedChunks.get(chunk.jobId);
491 if (completedSet) {
492 completedSet.add(chunk.id);
493 }
494
495 this.updateJobProgress(chunk.jobId);
496 await this.checkJobCompletion(chunk.jobId);
497 } catch (error) {
498 chunk.status = "failed";
499 handleLog(`Worker ${workerId} failed chunk ${chunk.id}: ${error}`);
500 } finally {
501 this.cleanupWorkerAssignment(workerId);
502 }
503 }
504
505 private async processDateRangeChunk(
506 chunk: WorkChunk,

Callers 1

createAsyncWorkerMethod · 0.95

Calls 5

processDateRangeChunkMethod · 0.95
updateJobProgressMethod · 0.95
checkJobCompletionMethod · 0.95
handleLogFunction · 0.90

Tested by

no test coverage detected