Goal
Add a concurrency() function and @concurrency() method decorator to bound parallel executions.
const resizeImage = concurrency(
async (image: Buffer) => imageProcessor.resize(image),
{ limit: 4, maxQueueSize: 100 }
);
Scope
- Configurable
limit
- FIFO queue and queue-size visibility
maxQueueSize with configurable reject/drop behavior
AbortSignal support for waiting calls
- Per-instance decorator queues and optional shared key
- Unit tests and documentation
Trace integration
Record queue wait time, start/end time, saturation, rejection, and cancellation.
Acceptance criteria
- No more than
limit executions run simultaneously
- Queued calls preserve order and their own arguments
- Decorator state is isolated per class instance by default
- Public API is exported from the package entry point
Goal
Add a
concurrency()function and@concurrency()method decorator to bound parallel executions.Scope
limitmaxQueueSizewith configurable reject/drop behaviorAbortSignalsupport for waiting callsTrace integration
Record queue wait time, start/end time, saturation, rejection, and cancellation.
Acceptance criteria
limitexecutions run simultaneously