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

Method stop

src/sync/watcher.ts:943–988  ·  view source on GitHub ↗

* Stop watching for file changes.

()

Source from the content-addressed store, hash-verified

941 * Stop watching for file changes.
942 */
943 stop(): void {
944 this.stopped = true;
945 if (this.treeRefreshTimer) clearTimeout(this.treeRefreshTimer);
946 this.treeRefreshTimer = null;
947 for (const check of this.goneChecks.values()) clearTimeout(check);
948 this.goneChecks.clear();
949 this.knownDirs.clear();
950 this.watchedRealDirs.clear();
951 this.recoveringFromLock = false;
952
953 if (this.debounceTimer) {
954 clearTimeout(this.debounceTimer);
955 this.debounceTimer = null;
956 }
957
958 if (this.recursiveWatcher) {
959 try {
960 this.recursiveWatcher.close();
961 } catch {
962 /* already closed */
963 }
964 this.recursiveWatcher = null;
965 }
966 for (const w of this.dirWatchers.values()) {
967 try {
968 w.close();
969 } catch {
970 /* already closed */
971 }
972 }
973 this.dirWatchers.clear();
974 this.dirCapWarned = false;
975 this.inotifyLimitWarned = false;
976 this.lockRetryCount = 0;
977 this.syncFailureRetryCount = 0;
978 // NB: degradedReason is intentionally NOT reset here — it must survive the
979 // stop() that degrade() triggers so isDegraded() stays true. start() clears it.
980 this.visitedRealDirs.clear();
981 this.inert = false;
982
983 this.pendingFiles.clear();
984 this.ready = false;
985 this.ignoreMatcher = null;
986 if (IS_TEST_RUNTIME) liveWatchersForTests.delete(this.projectRoot);
987 logDebug('File watcher stopped');
988 }
989
990 /**
991 * @internal Test-only: feed a synthetic project-relative change through the

Callers 2

startMethod · 0.95
degradeMethod · 0.95

Calls 4

logDebugFunction · 0.90
closeMethod · 0.65
deleteMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected