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

Method withLock

src/utils.ts:740–747  ·  view source on GitHub ↗

* Execute a function while holding the lock

(fn: () => Promise<T> | T)

Source from the content-addressed store, hash-verified

738 * Execute a function while holding the lock
739 */
740 async withLock<T>(fn: () => Promise<T> | T): Promise<T> {
741 const release = await this.acquire();
742 try {
743 return await fn();
744 } finally {
745 release();
746 }
747 }
748
749 /**
750 * Check if the lock is currently held

Callers 6

indexAllMethod · 0.45
indexFilesMethod · 0.45
syncMethod · 0.45
runDeferredSynthesisMethod · 0.45
security.test.tsFile · 0.45

Calls 3

acquireMethod · 0.95
releaseFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected