MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / withLock

Function withLock

src/utils/file-lock.ts:75–82  ·  view source on GitHub ↗
(lockPath: string, fn: () => Promise<T>, opts?: LockOptions)

Source from the content-addressed store, hash-verified

73
74/** Run `fn` while holding `lockPath`; always releases, even on throw. */
75export async function withLock<T>(lockPath: string, fn: () => Promise<T>, opts?: LockOptions): Promise<T> {
76 const lock = await acquireLock(lockPath, opts);
77 try {
78 return await fn();
79 } finally {
80 await lock.release();
81 }
82}

Callers 7

setEnvKeyFunction · 0.85
writeConfigFunction · 0.85
addProviderToConfigFunction · 0.85
updateArtifactFunction · 0.85
rollbackArtifactFunction · 0.85
saveUserConfigFunction · 0.85

Calls 1

acquireLockFunction · 0.85

Tested by

no test coverage detected