MCPcopy
hub / github.com/colbymchenry/codegraph / withLock

Method withLock

src/utils.ts:405–412  ·  view source on GitHub ↗

* Execute a function while holding the lock

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

Source from the content-addressed store, hash-verified

403 * Execute a function while holding the lock
404 */
405 async withLock<T>(fn: () => Promise<T> | T): Promise<T> {
406 const release = await this.acquire();
407 try {
408 return await fn();
409 } finally {
410 release();
411 }
412 }
413
414 /**
415 * Check if the lock is currently held

Callers 4

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

Calls 2

acquireMethod · 0.95
fnFunction · 0.50

Tested by

no test coverage detected