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

Method armGoneCheck

src/sync/watcher.ts:784–802  ·  view source on GitHub ↗

* On Windows, libuv reports a watched folder that is being deleted by the * folder's own absolute path (`\\?\D:\…`) and re-arms the read, which fails * the same way at once: thousands of events a second until the stream is * closed, holding a core for good. A directory link in the project w

(dir: string)

Source from the content-addressed store, hash-verified

782 * project folder that is gone degrades the watcher, closing every stream.
783 */
784 private armGoneCheck(dir: string): void {
785 if (this.stopped || this.goneChecks.has(dir)) return;
786 const isRoot = dir === this.projectRoot;
787 if (!isRoot && !this.dirWatchers.has(dir)) return; // its stream is already closed
788 const timer = setTimeout(() => {
789 this.goneChecks.delete(dir);
790 if (this.stopped) return;
791 if (isRoot) {
792 if (!isDirectory(this.projectRoot)) this.degrade(ROOT_GONE_REASON, { projectRoot: this.projectRoot });
793 return;
794 }
795 if (realpathOrNull(dir) === this.watchedRealDirs.get(dir)) return;
796 logDebug('Watched link no longer leads to its folder; closing its stream', { dir });
797 this.unwatchDir(dir);
798 this.scheduleTreeRefresh();
799 }, GONE_CHECK_DELAY_MS);
800 timer.unref?.();
801 this.goneChecks.set(dir, timer);
802 }
803
804 /** Close and forget the watch for a directory that errored/was removed. */
805 private unwatchDir(dir: string): void {

Callers 1

handleDirEventMethod · 0.95

Calls 10

degradeMethod · 0.95
unwatchDirMethod · 0.95
scheduleTreeRefreshMethod · 0.95
logDebugFunction · 0.90
realpathOrNullFunction · 0.85
hasMethod · 0.80
isDirectoryFunction · 0.70
deleteMethod · 0.65
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected