MCPcopy Create free account
hub / github.com/effect-app/libs / createLock

Function createLock

packages/infra/src/ClusterCosmos.ts:902–918  ·  view source on GitHub ↗
(address: string, shardId: string, now: number)

Source from the content-addressed store, hash-verified

900 )
901
902 const createLock = (address: string, shardId: string, now: number) =>
903 Effect
904 .tryPromise(() =>
905 container.items.create<LockDoc>({
906 id: lockDocId(shardId),
907 _partitionKey: "lock",
908 type: "lock",
909 shardId,
910 address,
911 acquiredAt: now
912 })
913 )
914 .pipe(
915 Effect.tap(annotateItem),
916 Effect.as(true),
917 Effect.catchIf(isConflict, () => Effect.succeed(false))
918 )
919
920 const tryAcquire = (address: string, shardId: string, now: number) =>
921 readLock(shardId).pipe(

Callers 1

tryAcquireFunction · 0.85

Calls 3

lockDocIdFunction · 0.85
pipeMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…