bullmq - v5.77.1
    Preparing search index...

    Class AsyncFifoQueue<T>

    AsyncFifoQueue

    A minimal FIFO queue for asynchronous operations. Allows adding asynchronous operations and consume them in the order they are resolved.

    Type Parameters

    • T
    Index

    Constructors

    Methods

    • Adds a promise to the queue. When it resolves, its value is enqueued and, if a consumer is waiting via fetch, the next pending promise is resolved with the value.

      Parameters

      • promise: Promise<T>

        The asynchronous operation to add to the queue.

      Returns void

    • Fetches the next resolved item from the queue in FIFO order. If no items are currently resolved but pending promises exist, it waits until the next one resolves.

      Returns Promise<void | T>

      The next resolved value, or undefined if there are no pending or queued items.

    • Returns the number of promises that are still pending (in-flight).

      Returns number

      The number of unresolved promises currently in the queue.

    • Returns the number of items that have already resolved but have not yet been fetched by a consumer.

      Returns number

      The number of resolved items waiting to be consumed.

    • Returns the total number of items currently tracked by the queue, including both pending (in-flight) promises and resolved items that have not yet been fetched.

      Returns number

      The sum of pending and queued items.

    • Waits for all currently pending promises to settle.

      Returns Promise<void>

      A promise that resolves once every in-flight promise has resolved.