MCPcopy Create free account
hub / github.com/dyoshikawa/rulesync / withSemaphore

Function withSemaphore

src/lib/github-utils.ts:12–19  ·  view source on GitHub ↗
(semaphore: Semaphore, fn: () => Promise<T>)

Source from the content-addressed store, hash-verified

10 * Ensures the semaphore permit is always released, even if the function throws.
11 */
12export async function withSemaphore<T>(semaphore: Semaphore, fn: () => Promise<T>): Promise<T> {
13 await semaphore.acquire();
14 try {
15 return await fn();
16 } finally {
17 semaphore.release();
18 }
19}
20
21/**
22 * Recursively list all files in a GitHub directory.

Callers 9

listDirectoryRecursiveFunction · 0.85
fetchGithubSkillDirFunction · 0.85
fetchFilesFunction · 0.85
getCachedDirectoryFunction · 0.85
fetchAndConvertToolFilesFunction · 0.85
discoverValidatedSkillsFunction · 0.85
buildSkillDeploymentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…