pub struct RedisManager<'a> { /* private fields */ }
Expand description

Manages queues and jobs within Redis. Contains main public functions that are called by HTTP services.

Internally, uses RedisJob and RedisQueue structs as convenient wrappers around interacting with jobs/queues.

Implementations

Get a new manager that uses given connection.

Create or update a queue in Redis with given name and settings.

Returns true if a new queue was created, or false if an existing queue was updated.

Delete queue with given name from Redis.

Returns true if a queue was deleted, and false if no queue with given name was found.

Delete a job with given ID from Redis.

Returns true if a job was found and deleted, false if no job with given ID was found.

Get summary of server and queue data. Currently contains:

  • count of each job’s status by queue
  • total number of jobs processed and their final status

Get one or more metadata fields from given job ID.

If None is given as the fields argument, then get all fields.

Update one or more job metadata fields.

Only following fields can be updated in this way:

  • status - used to mark job as completed/failed/cancelled etc.
  • output - used to update user provided information related to this job

Update a job’s last_heartbeat field with the current date/time.

Get the status field of given job.

Update a job’s status field to the given status, if an allowed state transition.

Identical to calling update_job and with Some(status) provided.

Get the output field of given job.

Update a job’s output field to the given output data.

Identical to calling update_job and with Some(output) provided.

Get a list of jobs IDs with given tag name.

Get list of all queue names.

Get given queue’s current settings.

Get the number of queues jobs in given queue.

Get total number of running jobs across all queues.

Get total number of failed jobs across all queues.

Get total number of ended jobs across all queues.

Check all jobs in the failed queue for retries.

Any which can be retried are re-queued on the queue they were created it.

Any which have no automatic retries remaining are moved to the ended queue.

Check all jobs in the running queue for timeouts.

Any which timeout are moved to the failed queue, where they’ll eventually either be retried, or moved to the ended queue.

Check all jobs in the ended queue for expiry. Any expired jobs will be entirely removed from the queue system.

Checks the integrity of Redis DB, e.g. checking for dangling indexes, jobs in invalid states, etc.

Mostly intended for use during development, as it has a non-trivial runtime cost.

Check connection to Redis using ping command.

Fetch the next job from given queue, if any.

Returns

A job::Payload if a job is found, or None if the queue is empty.

Create a new job on given queue.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.