Manages a lazily created PriorityQueue per server origin so the requests to every server are prioritized and limited independently, and a slow or saturated server can never delay the requests made to others. The items added without a url are managed as their own group.
Properties
returns whether tasks are queued or actively running in any origin queue
maxJobsPerOrigin: number = 6
Maximum number of requests that can run concurrently per server.
priorityCallback: ( a: any, b: any ) => number | null = null
Comparator used to sort the queued items of every origin queue.
Methods
add(
// Url the item requests data from
url: string | null,
item: any,
// Invoked with `item` when it is dequeued; may return a Promise
callback: ( item: any ) => Promise<any> | any,
// Removes the item from the queue when aborted
signal: AbortSignal | null = null
): Promise<any>Adds an item to the queue of the url's server and returns a Promise that resolves when the item's callback completes, or rejects if the item is removed before running.
remove( item: any ): voidRemoves an item from its origin queue, rejecting its promise with an AbortError DOMException.
has( item: any ): booleanReturns whether the given item is currently queued.