IF Commons GitHub

logical/pool

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-repoctl-sync FR-007

Jobs run a few at a time (commons repoctl 0003-repoctl-sync FR-007): the checks of the libraries are independent reads, so they run in a pool of a fixed width, and their results are in the order of the jobs, whatever order they finished in. A pure function of the jobs it is given.

import { pool } from "./pool.ts";
await pool([3, 1, 2], 2, (n) => Promise.resolve(n * 2)); // [6, 2, 4]

Source: commons/repoctl/src/logical/pool.ts

0 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.poolfunctionno test imports it
function pool<T, R>(items: readonly T[], width: number, job: (item: T) => Promise<R>): Promise<readonly R[]>

Runs job on each item, at most width at a time, and gives the results in the order of the items.

poolfunctionno test imports it
function pool<T, R>(items: readonly T[], width: number, job: (item: T) => Promise<R>): Promise<readonly R[]>

Runs job on each item, at most width at a time, and gives the results in the order of the items.

Titles, headings, exports, tables, columns and requirements. Esc closes.