Function
withLock
(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
Tested by
no test coverage detected