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

Method rearmAfterLockContention

src/sync/watcher.ts:917–938  ·  view source on GitHub ↗

* Re-arm a watcher disabled by lock contention when a caller next uses the * graph. Keep the whole-index stale banner until a FULL scan reconciles edits * missed while watches were off. Resource exhaustion and deterministic sync * failures are not automatically retried. Repeated unsuccessfu

()

Source from the content-addressed store, hash-verified

915 * throttled so many MCP sessions cannot hammer a long-lived writer.
916 */
917 rearmAfterLockContention(): boolean {
918 if (!this.degradedByLock || this.isActive()) return false;
919 const now = Date.now();
920 if (this.lastLockRearmMs && now - this.lastLockRearmMs < LOCK_REARM_COOLDOWN_MS) return false;
921 const reason = this.degradedReason;
922 this.lastLockRearmMs = now;
923 if (!this.start()) {
924 // A disabled platform can reject start() without calling degrade().
925 // Preserve the old stale-index signal in that case; a new resource
926 // failure has its own more precise degraded reason.
927 if (!this.degradedReason) {
928 this.degradedReason = reason;
929 this.degradedByLock = true;
930 }
931 return false;
932 }
933 this.degradedReason = reason;
934 this.recoveringFromLock = true;
935 this.needsFullScan = true;
936 this.scheduleSync();
937 return true;
938 }
939
940 /**
941 * Stop watching for file changes.

Callers 2

watcher.test.tsFile · 0.80

Calls 3

isActiveMethod · 0.95
startMethod · 0.95
scheduleSyncMethod · 0.95

Tested by

no test coverage detected