use npm:p-queue
instead
import { AsyncQueue } from "https://deno.land/x/yxz@0.32.0/async/queue.ts";
Promise queue with concurrency control
Constructors
Type Parameters
Methods
Adds a sync or async task to the queue. Always returns a promise.
Same as .add()
, but accepts an array of sync or async functions.
Can be called multiple times. Useful if you for example add additional items at a later time
The difference with .onEmpty
is that .onIdle
guarantees that all work from the queue has finished. .onEmpty
merely signals that the queue is empty, but it could mean that some promises haven't completed yet
Size of the queue, filtered by the given options.
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via options.autoStart = false
or by .pause()
method.)