Skip to content

Commit

Permalink
change(web): concurrency lock-management ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
jahorton committed Feb 27, 2024
1 parent 57079f3 commit b09a1ba
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,10 @@ export class MatcherSelector<Type, StateToken = any> extends EventEmitter<EventM

await parentLockPromise;

childLock.resolve(); // allow the next matchGesture call through.

if(this.pendingMatchSetup == childLock.corePromise) {
this.pendingMatchSetup = null;
}
childLock.resolve(); // allow the next matchGesture call through.
}

if(sourceNotYetStaged) {
Expand Down Expand Up @@ -334,12 +333,13 @@ export class MatcherSelector<Type, StateToken = any> extends EventEmitter<EventM
// (which itself needs a macroqueue wait)
await timedPromise(0);

matchingLock.resolve();
// Only clear the promise if no extra entries were added to the implied `matchGesture` queue.
if(this.pendingMatchSetup == matchingLock.corePromise) {
this.pendingMatchSetup = null;
}

matchingLock.resolve();

// stateToken may have shifted by the time we regain control here.
const incomingStateToken = this.stateToken;

Expand Down

0 comments on commit b09a1ba

Please sign in to comment.