import { IProgressService } from '../interfaces/IProgressService'; import { ITaskQueueService } from '../interfaces/ITaskQueueService'; import { IWorkerService } from '../interfaces/IWorkerService'; export class ProgressService implements IProgressService { private taskQueueService: ITaskQueueService; private workerService: IWorkerService; constructor(taskQueueService: ITaskQueueService, workerService: IWorkerService) { this.taskQueueService = taskQueueService; this.workerService = workerService; } public async recordProgress( workerId: string, taskId: string, progress: number, rowsProcessed?: number, currentSpeed?: number ): Promise { await Promise.all([ this.taskQueueService.updateTaskProgress(taskId, progress, rowsProcessed), this.workerService.recordHeartbeat(workerId, taskId, rowsProcessed, currentSpeed), ]); } }