signalk-parquet
Version:
Vessel data Parquet file archive with automated value and geospatial triggers. History API compliant with cloud backups and queries.
37 lines • 1.08 kB
TypeScript
/**
* Limits the number of concurrent promise executions
*
* @example
* const limiter = new ConcurrencyLimiter(5);
* const results = await limiter.map(items, async (item) => {
* return await processItem(item);
* });
*/
export declare class ConcurrencyLimiter {
private maxConcurrent;
private running;
private queue;
constructor(maxConcurrent?: number);
/**
* Execute an async function with concurrency limiting
*/
private execute;
/**
* Map over an array with concurrency limiting
* Similar to Promise.all() but with controlled concurrency
*
* @param items - Array of items to process
* @param fn - Async function to execute for each item
* @returns Array of results in the same order as input
*/
map<T, R>(items: T[], fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
/**
* Get current concurrency statistics
*/
getStats(): {
running: number;
queued: number;
maxConcurrent: number;
};
}
//# sourceMappingURL=concurrency-limiter.d.ts.map