Pick ready nodes that don't collide (by file) with locked or each other.
(slots: number)
| 97 | |
| 98 | /** Pick ready nodes that don't collide (by file) with locked or each other. */ |
| 99 | private selectRunnable(slots: number): TaskNode[] { |
| 100 | const locked = this.lockedFiles(); |
| 101 | const chosen: TaskNode[] = []; |
| 102 | const willLock = new Set<string>(); |
| 103 | |
| 104 | for (const node of this.graph.nodes.values()) { |
| 105 | if (chosen.length >= slots) break; |
| 106 | if (node.status !== 'ready') continue; |
| 107 | // Skip if any target file is locked by an in-flight node or an earlier pick. |
| 108 | const collides = node.targetFiles.some(f => locked.has(f) || willLock.has(f)); |
| 109 | if (collides) continue; |
| 110 | chosen.push(node); |
| 111 | for (const f of node.targetFiles) willLock.add(f); |
| 112 | } |
| 113 | return chosen; |
| 114 | } |
| 115 | |
| 116 | /** Promote pending nodes whose deps are committed → ready; block broken ones. */ |
| 117 | private refreshStatuses() { |
no test coverage detected