Skip to content

feat: add concurrency function and @concurrency decorator #74

Description

@tabkram

Goal

Add a concurrency() function and @concurrency() method decorator to bound parallel executions.

constresizeImage=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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions