import { Queue } from "https://deno.land/x/kvmq@v0.3.0/mod.ts";
Represents a job queue in the database.
Allows listing jobs in the queue and pushing new jobs.
Constructors
Initialize a job queue.
Properties
Kv database to use for storing the queue.
Key prefix to use for storing queue's data.
Methods
Shorthand for constructing a Worker for this queue.
Removes all jobs that aren't currently being processed from the queue.
TODO: make this atomic.
Returns an array of all jobs in this queue, from front to back.
The jobs are sorted by priority first, then by creation date, ascending.
Listens for queue updates.
Note: currently it just polls the queue every few seconds.
Pauses the processing of this queue.
Sets a paused flag in the database that is checked by workers.
A paused queue will not process new jobs until resumed, but current jobs being processed will continue until they are finalized.
Creates a new job and adds it to the queue.
Returns job ID.
Resumes the processing of this queue.
Resets a paused flag in the database that is checked by workers.