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

Method withLock

src/utils.ts:738–745  ·  view source on GitHub ↗

* Execute a function while holding the lock

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

Source from the content-addressed store, hash-verified

736 * Execute a function while holding the lock
737 */
738 async withLock<T>(fn: () => Promise<T> | T): Promise<T> {
739 const release = await this.acquire();
740 try {
741 return await fn();
742 } finally {
743 release();
744 }
745 }
746
747 /**
748 * 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