MCPcopy Create free account
hub / github.com/anomalyco/opencode / withLock

Function withLock

packages/core/src/util/flock.ts:342–346  ·  view source on GitHub ↗
(key: string, fn: () => Promise<T>, input: Options = {})

Source from the content-addressed store, hash-verified

340 }
341
342 export async function withLock<T>(key: string, fn: () => Promise<T>, input: Options = {}) {
343 await using _ = await acquire(key, input)
344 input.signal?.throwIfAborted()
345 return await fn()
346 }
347
348 export const effect = Effect.fn("Flock.effect")(function* (key: string, input: Options = {}) {
349 return yield* Effect.acquireRelease(

Callers

nothing calls this directly

Calls 2

acquireFunction · 0.85
fnFunction · 0.50

Tested by

no test coverage detected