Skip to main content
Module

x/carriageway/mod.ts>IQueue

🦥 Run async functions with limited concurrency and optional rate limiting
Go to Latest
interface IQueue
Re-export
import { type IQueue } from "https://deno.land/x/carriageway@v0.8.1/mod.ts";

Properties

readonly
pending: number

Number of active items running now

readonly
waiting: number

Number of queued items waiting to run

readonly
length: number

Total number of active and queued items

concurrency: number

Maximum number of active items running at once

throttle: number

Minimum number of milliseconds between start of each item

Methods

has(item: T): boolean

Returns true if item is queued (active or waiting)

get(item: T): Promise<R> | undefined

Returns the deferred promise for the item

append(item: T, callback: QueueCallback<T, R>): Promise<R>

Append an item to the queue

prepend(item: T, callback: QueueCallback<T, R>): Promise<R>

Prepend an item to the queue

sort(compare: (a: T, b: T) => number): void

Prioritize the order of queued items

clear(): void

Clear the queue