MCPcopy Create free account
hub / github.com/codag-megalith/codag-visualizer / saveCallGraphsToStorage

Function saveCallGraphsToStorage

frontend/src/analysis/state.ts:121–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119/** Save call graphs to persistent storage (debounced) */
120let saveTimeout: NodeJS.Timeout | null = null;
121function saveCallGraphsToStorage(): void {
122 if (!extensionContext) return;
123
124 // Debounce saves to avoid excessive writes
125 if (saveTimeout) clearTimeout(saveTimeout);
126 saveTimeout = setTimeout(() => {
127 try {
128 const toStore: Record<string, SerializedCallGraph> = {};
129 for (const [key, value] of cachedCallGraphs.entries()) {
130 toStore[key] = serializeCallGraph(value);
131 }
132 extensionContext!.globalState.update(CALL_GRAPH_CACHE_KEY, toStore);
133 } catch (e) {
134 console.error('[CallGraph] Failed to save to storage:', e);
135 }
136 }, 1000);
137}
138
139export function getCachedCallGraph(filePath: string): ExtractedCallGraph | undefined {
140 return cachedCallGraphs.get(filePath);

Callers 1

setCachedCallGraphFunction · 0.85

Calls 2

serializeCallGraphFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected