MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / scheduleSync

Method scheduleSync

src/sync/watcher.ts:1033–1051  ·  view source on GitHub ↗

* Schedule a normal debounced sync after a source edit.

()

Source from the content-addressed store, hash-verified

1031 * Schedule a normal debounced sync after a source edit.
1032 */
1033 private scheduleSync(): void {
1034 if (this.debounceTimer) {
1035 clearTimeout(this.debounceTimer);
1036 }
1037 // Adaptive quiet window: a lone save (or a pair — editor + its test file)
1038 // fires fast so the graph feels instant; anything bigger keeps the full
1039 // configured window so an agent's multi-file burst still coalesces into
1040 // one sync exactly as before. Re-arming on each event preserves the
1041 // trailing-edge semantics either way: if more events arrive inside the
1042 // quick window, the reschedule sees the larger pending set and extends to
1043 // the full window. Never exceeds the configured debounce (a user-lowered
1044 // CODEGRAPH_WATCH_DEBOUNCE_MS stays authoritative), floor 100ms.
1045 const quickMs = Math.max(100, Math.min(QUICK_SYNC_QUIET_MS, this.debounceMs));
1046 const delay = this.pendingFiles.size <= QUICK_SYNC_MAX_PENDING ? quickMs : this.debounceMs;
1047 this.debounceTimer = setTimeout(() => {
1048 this.debounceTimer = null;
1049 this.flush();
1050 }, delay);
1051 }
1052
1053 /**
1054 * Schedule a retry after a recoverable sync failure (lock contention). Kept

Callers 6

scheduleTreeRefreshMethod · 0.95
handleChangeMethod · 0.95
refreshScopeMethod · 0.95
flushMethod · 0.95

Calls 1

flushMethod · 0.95

Tested by

no test coverage detected