pub struct JobQueue { /* private fields */ }Expand description
The enqueue side of the queue, plus the runner’s wake-up.
Cloneable and cheap to hold: everything inside is an Arc or a scalar. A
subsystem that queues work holds one of these and never sees the runner.
Implementations§
Source§impl JobQueue
impl JobQueue
pub fn new(database: Arc<Database>, config: &JobsConfig) -> Self
Sourcepub fn set_max_attempts(&self, max_attempts: u32)
pub fn set_max_attempts(&self, max_attempts: u32)
Republishes jobs.max_attempts, for every clone of this queue at once.
Synchronous and infallible, which is what lets a reload call it from
cli::apply_reload’s publishing run beside the watch sends.
It sets the budget for work queued from now on and does not touch the
backlog: max_attempts is frozen onto each row at enqueue, so a job
already waiting keeps the budget it was queued under. Raising this to
rescue rows that are about to give up is therefore not what it does —
that would be an UPDATE over pending rows, and a deliberately different
promise from the one crate::sqlite::job makes.
Sourcepub async fn enqueue(&self, spec: JobSpec) -> Result<bool, Error>
pub async fn enqueue(&self, spec: JobSpec) -> Result<bool, Error>
Queues one job.
Ok(false) means a live job already holds this (kind, key) — not an
error, but the answer two racing callers must both survive. The caller
reads it the way RelaySigner::issue reads UpstreamOrder::create’s
Ok(None): somebody else is already on it.
Sourcepub async fn enqueue_or_log(&self, spec: JobSpec) -> bool
pub async fn enqueue_or_log(&self, spec: JobSpec) -> bool
JobQueue::enqueue, logging rather than returning a database failure.
For the callers with nowhere to report one — recover, which the trait
defines as best-effort, and any path where refusing to queue is worse
than the error it would surface.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for JobQueue
impl !UnwindSafe for JobQueue
impl Freeze for JobQueue
impl Send for JobQueue
impl Sync for JobQueue
impl Unpin for JobQueue
impl UnsafeUnpin for JobQueue
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more