(token: number)
| 305 | } |
| 306 | |
| 307 | function queueTaskProgressLoad(token: number) { |
| 308 | const activeChanges = changesTree.value.filter(n => n.name !== 'archive') |
| 309 | const pending = activeChanges.filter(node => !taskProgressCache.has(normalizePath(node.path))) |
| 310 | const initialNodes = pending.slice(0, TASK_PROGRESS_INITIAL_BATCH) |
| 311 | const remaining = pending.slice(TASK_PROGRESS_INITIAL_BATCH) |
| 312 | |
| 313 | void loadTaskProgressForNodes(initialNodes, 'initial') |
| 314 | |
| 315 | if (remaining.length === 0) return |
| 316 | let index = 0 |
| 317 | const batchSize = TASK_PROGRESS_INITIAL_BATCH |
| 318 | |
| 319 | const runBatch = async () => { |
| 320 | if (token !== loadToken) return |
| 321 | const slice = remaining.slice(index, index + batchSize) |
| 322 | if (slice.length === 0) return |
| 323 | await loadTaskProgressForNodes(slice, 'background') |
| 324 | index += batchSize |
| 325 | if (index < remaining.length) { |
| 326 | window.setTimeout(runBatch, 120) |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | window.setTimeout(runBatch, 120) |
| 331 | } |
| 332 | |
| 333 | function scheduleProjectReload(reason: string) { |
| 334 | if (reloadTimer !== null) { |
no test coverage detected