Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/hono/dist/utils/concurrent.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/concurrent.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/hono/dist/utils/concurrent.js
-
curl -L -o concurrent.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/concurrent.js
813 Bytes
| //#region src/utils/concurrent.ts | |
| /** | |
| * @module | |
| * Concurrent utility. | |
| */ | |
| const DEFAULT_CONCURRENCY = 1024; | |
| const createPool = ({ concurrency, interval } = {}) => { | |
| concurrency ||= DEFAULT_CONCURRENCY; | |
| if (concurrency === Infinity) return { run: async (fn) => fn() }; | |
| const pool = /* @__PURE__ */ new Set(); | |
| const run = async (fn, promise, resolve) => { | |
| if (pool.size >= concurrency) { | |
| promise ||= new Promise((r) => resolve = r); | |
| setTimeout(() => run(fn, promise, resolve)); | |
| return promise; | |
| } | |
| const marker = {}; | |
| pool.add(marker); | |
| const result = await fn(); | |
| if (interval) setTimeout(() => pool.delete(marker), interval); | |
| else pool.delete(marker); | |
| if (resolve) { | |
| resolve(result); | |
| return promise; | |
| } else return result; | |
| }; | |
| return { run }; | |
| }; | |
| //#endregion | |
| export { createPool }; | |