import { type JobData } from "https://deno.land/x/kvmq@v0.3.0/mod.ts";
Data about a job as stored in the database.
Properties
Any data that is passed to the worker when processing this job.
The time at which this job can be processed.
A job with a delay will not start being processed even if it is at the front of the queue. The other jobs behind it will be processed first until the delay expires.
This value is reset on every repeat based on value of repeatDelayMs and on every retry based on value of retryDelayMs.
Workers set this date when they start processing this job.
As long as this date is in the future, the job is considered to be locked for processing by some worker.
Number of times to repeat this job.
When a worker finishes processing this job, it checks this value. If it's greater than 0, a new identical job is created with this value decremented. Repeating a job resets it's creation time, so it shows up again at the back of the queue.
Pass Infinity to repeat forever. Remember that a forever repeating job is saved in the database, so you should check if it already exists or clear the queue before adding it.
Minimum amount of milliseconds to wait between each job repeat.
Sets the delayUntil value this amount into the future when repeating this job.
Number of extra times to attempt this job if it fails.
If a worker fails to process this job, it checks this value. If it's greater than 0, it's decremented and the job is returned to the queue. Retrying a job doesn't change it's creation time, so it still appears at the front of the queue.