* Schedule a normal debounced sync after a source edit.
()
| 789 | * Schedule a normal debounced sync after a source edit. |
| 790 | */ |
| 791 | private scheduleSync(): void { |
| 792 | if (this.debounceTimer) { |
| 793 | clearTimeout(this.debounceTimer); |
| 794 | } |
| 795 | // Adaptive quiet window: a lone save (or a pair — editor + its test file) |
| 796 | // fires fast so the graph feels instant; anything bigger keeps the full |
| 797 | // configured window so an agent's multi-file burst still coalesces into |
| 798 | // one sync exactly as before. Re-arming on each event preserves the |
| 799 | // trailing-edge semantics either way: if more events arrive inside the |
| 800 | // quick window, the reschedule sees the larger pending set and extends to |
| 801 | // the full window. Never exceeds the configured debounce (a user-lowered |
| 802 | // CODEGRAPH_WATCH_DEBOUNCE_MS stays authoritative), floor 100ms. |
| 803 | const quickMs = Math.max(100, Math.min(QUICK_SYNC_QUIET_MS, this.debounceMs)); |
| 804 | const delay = this.pendingFiles.size <= QUICK_SYNC_MAX_PENDING ? quickMs : this.debounceMs; |
| 805 | this.debounceTimer = setTimeout(() => { |
| 806 | this.debounceTimer = null; |
| 807 | this.flush(); |
| 808 | }, delay); |
| 809 | } |
| 810 | |
| 811 | /** |
| 812 | * Schedule a retry after a recoverable sync failure (lock contention). Kept |
no test coverage detected