Shumoku Docs

ドキュメントを検索

共通文書と現行公開版

検索を読み込み中…

English

@shumoku/core · 0.4.0 · function

mapWithConcurrency

ソース

APIの説明は英語のcanonical sourceを表示しています。

Run `fn` over `items` with at most `limit` calls in flight at once, preserving input order in the result array. Replaces the two failure modes the audit found: unbounded `Promise.all` fan-out (network-scan would open hundreds of SNMP sockets at once) and fully sequential `await`-in-a-loop polling (zabbix walked hosts one by one). A rejected `fn` rejects the whole call (like `Promise.all`); a caller wanting partial results should catch inside `fn`.

mapWithConcurrency(items: readonly T[], limit: number, fn: object): Promise<R[]>

パラメーター

名前 説明 既定値
items readonly T[] 追加説明はありません。
limit number 追加説明はありません。
fn object 追加説明はありません。

戻り値

Promise<R[]>

libs/@shumoku/core/src/plugin-kit/concurrency.ts:15