MCPcopy Create free account
hub / github.com/ConsortiumAI/Consortium / unlock

Method unlock

packages/consortium-cli/src/utils/lock.ts:22–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 }
21
22 private unlock() {
23 this.permits += 1;
24 if (this.permits > 1 && this.promiseResolverQueue.length > 0) {
25 throw new Error('this.permits should never be > 0 when there is someone waiting.');
26 } else if (this.permits === 1 && this.promiseResolverQueue.length > 0) {
27 this.permits -= 1;
28 const nextResolver = this.promiseResolverQueue.shift();
29 if (nextResolver) {
30 setTimeout(() => {
31 nextResolver(true);
32 }, 0);
33 }
34 }
35 }
36}

Callers 1

inLockMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected