/** * @file Bounded concurrency promise queue. Exports the `PromiseQueue` class, * which limits how many async tasks run simultaneously, supports an optional * max queue length (new tasks beyond the cap are rejected with "Task dropped: * queue length exceeded"), and exposes an idle-wait helper. */ export declare class PromiseQueue { private queue; private running; private idleResolvers; private readonly maxConcurrency; private readonly maxQueueLength; /** * Creates a new PromiseQueue. * * @param maxConcurrency - Maximum number of promises that can run * concurrently. * @param maxQueueLength - Maximum queue size; submissions past the cap reject * with "Task dropped: queue length exceeded" instead of evicting a caller * that has been waiting patiently. Callers must handle this rejection or * they'll see an unhandled rejection. */ constructor(maxConcurrency: number, maxQueueLength?: number | undefined); /** * Add a task to the queue. * * @param fn - Async function to execute. * * @returns Promise that resolves with the function's result, or rejects with * "Task dropped: queue length exceeded" if the queue is full. */ add(fn: () => Promise): Promise; private runNext; private notifyIdleIfNeeded; /** * Wait for all queued and running tasks to complete. */ onIdle(): Promise; /** * Get the number of tasks currently running. */ get activeCount(): number; /** * Get the number of tasks waiting in the queue. */ get pendingCount(): number; /** * Clear all pending tasks from the queue; running tasks are unaffected. */ clear(): void; }