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

Method withLock

src/utils.ts:714–721  ·  view source on GitHub ↗

* Execute a function while holding the lock

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

Source from the content-addressed store, hash-verified

712 * Execute a function while holding the lock
713 */
714 async withLock<T>(fn: () => Promise<T> | T): Promise<T> {
715 const release = await this.acquire();
716 try {
717 return await fn();
718 } finally {
719 release();
720 }
721 }
722
723 /**
724 * 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