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

Method checkJobCompletion

server/utils/import-queue.ts:617–644  ·  view source on GitHub ↗
(jobId: string)

Source from the content-addressed store, hash-verified

615 }
616
617 private async checkJobCompletion(jobId: string): Promise<void> {
618 const jobChunks = Array.from(this.workChunks.values()).filter(
619 (c) => c.jobId === jobId,
620 );
621 const completedChunks = jobChunks.filter((c) => c.status === "completed");
622
623 if (completedChunks.length === jobChunks.length && jobChunks.length > 0) {
624 const job = activeJobs.get(jobId);
625 if (job) {
626 const totalDaysWithData = jobChunks.reduce(
627 (sum, chunk) => sum + (chunk.data.processedDays || 0),
628 0,
629 );
630
631 updateJob(job, {
632 status: ImportStatus.Completed,
633 importedCount: totalDaysWithData,
634 });
635 handleLog(
636 `[${getLogPrefix(job.type)}] Job ${jobId} completed - processed ${totalDaysWithData} days across ${jobChunks.length} chunks`,
637 );
638 }
639
640 jobChunks.forEach((chunk) => this.workChunks.delete(chunk.id));
641 this.jobWorkerCount.delete(jobId);
642 this.completedChunks.delete(jobId);
643 }
644 }
645
646 private async processJob(job: QueueJob, workerId: number): Promise<void> {
647 try {

Callers 3

handleWorkCompletionMethod · 0.95
processWorkChunkMethod · 0.95
handleChunkCompletionMethod · 0.95

Calls 3

handleLogFunction · 0.90
updateJobFunction · 0.85
getLogPrefixFunction · 0.85

Tested by

no test coverage detected