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

Method inLock

packages/consortium-cli/src/utils/lock.ts:5–12  ·  view source on GitHub ↗
(func: () => Promise<T> | T)

Source from the content-addressed store, hash-verified

3 private promiseResolverQueue: Array<(v: boolean) => void> = [];
4
5 async inLock<T>(func: () => Promise<T> | T): Promise<T> {
6 try {
7 await this.lock();
8 return await func();
9 } finally {
10 this.unlock();
11 }
12 }
13
14 private async lock() {
15 if (this.permits > 0) {

Callers 2

updateMetadataMethod · 0.80
updateAgentStateMethod · 0.80

Calls 2

lockMethod · 0.95
unlockMethod · 0.95

Tested by

no test coverage detected