* Index specific files * * Uses a mutex to prevent concurrent indexing operations.
(filePaths: string[])
| 720 | * Uses a mutex to prevent concurrent indexing operations. |
| 721 | */ |
| 722 | async indexFiles(filePaths: string[]): Promise<IndexResult> { |
| 723 | return this.indexMutex.withLock(async () => { |
| 724 | try { |
| 725 | this.fileLock.acquire(); |
| 726 | } catch { |
| 727 | 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 }; |
| 728 | } |
| 729 | try { |
| 730 | return this.orchestrator.indexFiles(filePaths); |
| 731 | } finally { |
| 732 | this.fileLock.release(); |
| 733 | } |
| 734 | }); |
| 735 | } |
| 736 | |
| 737 | /** |
| 738 | * Sync with current file state (incremental update) |