pub struct DatabaseQueue { /* private fields */ }Expand description
A queue backed by database rows.
Implementations§
Source§impl DatabaseQueue
impl DatabaseQueue
Sourcepub fn with_reservation(self, reservation: Duration) -> Self
pub fn with_reservation(self, reservation: Duration) -> Self
How long a worker’s claim on a job lasts.
Must exceed the worker’s job timeout, or a job could be reclaimed and run twice while the first attempt is still going.
Sourcepub fn migrations() -> Migrator
pub fn migrations() -> Migrator
The migrations this driver needs.
Sourcepub async fn reclaim_expired(&self) -> Result<u64>
pub async fn reclaim_expired(&self) -> Result<u64>
Release every job whose reservation has lapsed, so a job held by a worker that died becomes available again. Returns how many.
Sourcepub async fn failed_jobs(&self, limit: u64) -> Result<Vec<FailedJobRow>>
pub async fn failed_jobs(&self, limit: u64) -> Result<Vec<FailedJobRow>>
Every failed job, newest first.
Sourcepub async fn retry_failed(&self, id: &str) -> Result<bool>
pub async fn retry_failed(&self, id: &str) -> Result<bool>
Put a failed job back on its queue for another run.
Trait Implementations§
Source§impl Debug for DatabaseQueue
impl Debug for DatabaseQueue
Source§impl Queue for DatabaseQueue
impl Queue for DatabaseQueue
Source§fn reserve<'a>(
&'a self,
queue: &'a str,
) -> BoxFuture<'a, Result<Option<QueuedJob>>>
fn reserve<'a>( &'a self, queue: &'a str, ) -> BoxFuture<'a, Result<Option<QueuedJob>>>
Reserve the next available job on
queue, or None if there is none.Source§fn acknowledge<'a>(&'a self, job: &'a QueuedJob) -> BoxFuture<'a, Result<()>>
fn acknowledge<'a>(&'a self, job: &'a QueuedJob) -> BoxFuture<'a, Result<()>>
Remove a finished job.
Source§fn release<'a>(
&'a self,
job: &'a QueuedJob,
delay: Duration,
) -> BoxFuture<'a, Result<()>>
fn release<'a>( &'a self, job: &'a QueuedJob, delay: Duration, ) -> BoxFuture<'a, Result<()>>
Return a job to the queue for another attempt, available after
delay.Source§fn fail<'a>(
&'a self,
job: &'a QueuedJob,
error: &'a str,
) -> BoxFuture<'a, Result<()>>
fn fail<'a>( &'a self, job: &'a QueuedJob, error: &'a str, ) -> BoxFuture<'a, Result<()>>
Move a job to the failed store after its last attempt.
Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseQueue
impl !UnwindSafe for DatabaseQueue
impl Freeze for DatabaseQueue
impl Send for DatabaseQueue
impl Sync for DatabaseQueue
impl Unpin for DatabaseQueue
impl UnsafeUnpin for DatabaseQueue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.