Handling concurrency with locks using Effect in TypeScript

What would be the idiomatic effect way to handle something like this:

export const doAll = Effect.gen(function* () {
  const lock = yield* Lock

  yield* lock.acquireLock("doing-things", 60)

  yield* Effect.all([thing1, thing2], { concurrency: 2 })
  
  yield* lock.releaseLock("doing-things")
})
Was this page helpful?