Skip to content

Instantly share code, notes, and snippets.

@becelli
becelli / concurrency-pool.ts
Last active January 8, 2024 13:26
A concurrency pool implementation in TypeScript
export class ConcurrencyPool<I> {
private readonly logger = console;
public constructor(
private readonly data: I[],
private readonly workerCount: number
) {}
public async executeSettled<O>(
mapper: (item: I) => Promise<O>