fynjs API
    Preparing search index...

    Type Alias ItemQueueOptions<ItemT>

    Item queue options

    type ItemQueueOptions<ItemT = unknown> = {
        concurrency?: number;
        handlers?: ItemQueueHandlers<ItemT>;
        itemQ?: ItemT[];
        processItem: ProcessCb<ItemT>;
        Promise?: PromiseConstructor;
        stopOnError?: boolean;
        timeout?: number;
        watchPeriod?: number;
        watchTime?: number;
    }

    Type Parameters

    • ItemT = unknown
    Index
    concurrency?: number

    number of to process concurrently

    event handlers

    itemQ?: ItemT[]

    initial array of items

    processItem: ProcessCb<ItemT>

    callback to process each item

    Promise?: PromiseConstructor

    pass in custom promise implementation

    stopOnError?: boolean

    immediately stop if an error occurred

    timeout?: number

    max milliseconds an item can take. A timed out item fails with an ETIMEDOUT error, its concurrency slot is freed, and a late result is ignored.

    • processItem receives an AbortSignal that is aborted on timeout. The queue can't cancel the work, so check the signal to stop it.
    watchPeriod?: number

    frequency the progress watcher should check for overdue items

    watchTime?: number

    The time an item has to take before reporting it to the progress watcher

    • If an item is already overdue but has not trigger the watchTime again yet, then it's report as part of the still items in the WatchData.