Skip to content

Commit

Permalink
Cleanup/fix distributed locks pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanEwen committed Dec 4, 2023
1 parent 105dec8 commit 8ac0a26
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions typescript/patterns/src/distributed_locks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ const lockServiceInternal = {
return { acquired: true, fencingToken } as TriedLockAcquisition;
},

acquireBlocking: async (ctx: restate.RpcContext, lockId: string): Promise<string> => {
const awakeable = ctx.awakeable<string>();
ctx.send(lockService).acquireAsync(lockId, awakeable.id);
return awakeable.promise;
},

acquireAsync: async (ctx: restate.RpcContext, lockId: string, awakeableId: string): Promise<void> => {
// we call this method here synchronously (we can, because we keep the same key)
const immediateAcquisition = await lockServiceInternal.tryAcquire(ctx, lockId);
Expand Down

0 comments on commit 8ac0a26

Please sign in to comment.