debt-collector
Version:
a nodejs tool to identify, track and mesure technical debt
21 lines (20 loc) • 767 B
TypeScript
type TaskResult<T> = {
status: 'fulfilled';
value: T;
} | {
status: 'rejected';
error: Error;
};
type Options = {
/** Delay in milliseconds between starting each task (default: 0) */
delayBetweenTasks?: number;
};
/**
* Executes an array of promise-returning functions with a maximum concurrency limit.
* @param tasks Array of functions that return promises
* @param concurrency Maximum number of promises to run simultaneously
* @param options Additional options for controlling execution
* @returns Promise that resolves with an array of results in the same order as input tasks
*/
export declare function runWithConcurrency<T>(tasks: (() => Promise<T>)[], concurrency: number, options?: Options): Promise<TaskResult<T>[]>;
export {};