Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BlockedQueue<I>

BlockedQueue

a blocked queue for async operations

since

5.19.0

Type parameters

  • I = any

Hierarchy

  • BlockedQueue

Index

Constructors

Methods

Constructors

constructor

  • new BlockedQueue<I>(capacity?: number, maxPending?: number): BlockedQueue<I>
  • Type parameters

    • I = any

    Parameters

    • capacity: number = 1000

      default 1000

    • maxPending: number = ...

      default 10 * capacity, the max allowed number of pending items

    Returns BlockedQueue<I>

Methods

deQueue

  • deQueue(): Promise<I>
  • retrieve an item from queue

    Returns Promise<I>

enQueue

  • enQueue(item: I): Promise<void>
  • push an item to the queue, blocked when the queue is full

    throws

    {QueueOverFlowError} throw when pending items are too much

    Parameters

    • item: I

    Returns Promise<void>