* Index specific files * * Uses a mutex to prevent concurrent indexing operations.
(filePaths: string[])
| 755 | * Uses a mutex to prevent concurrent indexing operations. |
| 756 | */ |
| 757 | async indexFiles(filePaths: string[]): Promise<IndexResult> { |
| 758 | return this.indexMutex.withLock(async () => { |
| 759 | try { |
| 760 | this.fileLock.acquire(); |
| 761 | } catch { |
| 762 | return { success: false, filesIndexed: 0, filesSkipped: 0, filesErrored: 0, nodesCreated: 0, edgesCreated: 0, errors: [{ message: 'Could not acquire file lock - another process may be indexing', severity: 'error' as const }], durationMs: 0 }; |
| 763 | } |
| 764 | try { |
| 765 | return this.orchestrator.indexFiles(filePaths); |
| 766 | } finally { |
| 767 | this.fileLock.release(); |
| 768 | } |
| 769 | }); |
| 770 | } |
| 771 | |
| 772 | /** |
| 773 | * Sync with current file state (incremental update) |