MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / run

Function run

src/pkg/utils/concurrency-control.test.ts:69–77  ·  view source on GitHub ↗
(id: number, wait?: Promise<void>)

Source from the content-addressed store, hash-verified

67 let releaseQueued: (() => void) | undefined;
68
69 const run = async (id: number, wait?: Promise<void>) => {
70 await sem.acquire();
71 concurrent++;
72 maxConcurrent = Math.max(maxConcurrent, concurrent);
73 order.push(id);
74 await wait;
75 concurrent--;
76 sem.release();
77 };
78
79 await sem.acquire();
80 concurrent++;

Callers 1

Calls 3

acquireMethod · 0.80
pushMethod · 0.80
releaseMethod · 0.80

Tested by

no test coverage detected