(
jobId: string,
userId: string,
type: "wakatime-api" | "wakatime-file" | "wakapi",
fileName: string,
totalToProcess?: number,
)
| 190 | } |
| 191 | |
| 192 | private getOrCreateJob( |
| 193 | jobId: string, |
| 194 | userId: string, |
| 195 | type: "wakatime-api" | "wakatime-file" | "wakapi", |
| 196 | fileName: string, |
| 197 | totalToProcess?: number, |
| 198 | ): ImportJob { |
| 199 | let job = activeJobs.get(jobId); |
| 200 | if (!job) { |
| 201 | job = createInitialImportJob(jobId, userId, type, fileName); |
| 202 | if (totalToProcess !== undefined) { |
| 203 | job.totalToProcess = totalToProcess; |
| 204 | job.processedCount = 0; |
| 205 | } |
| 206 | activeJobs.set(jobId, job); |
| 207 | } else { |
| 208 | updateJob(job, { |
| 209 | status: ImportStatus.Processing, |
| 210 | }); |
| 211 | if (totalToProcess !== undefined && !job.totalToProcess) { |
| 212 | job.totalToProcess = totalToProcess; |
| 213 | job.processedCount = 0; |
| 214 | activeJobs.set(jobId, job); |
| 215 | } |
| 216 | } |
| 217 | return job; |
| 218 | } |
| 219 | |
| 220 | private startWorkers(): void { |
| 221 | for (let i = 0; i < this.workerCount; i++) { |
no test coverage detected