pub struct QueuePause { /* private fields */ }Expand description
Dispatch gate shared through AppState, toggled by POST /api/queue/pause
and POST /api/queue/resume. When paused the dispatch loops stop pulling
new jobs off the channel; the job already running on a worker finishes
untouched. Cheap to poll (a single relaxed-ish atomic) so it can sit at the
top of every loop iteration.
Implementations§
Source§impl QueuePause
impl QueuePause
pub fn new() -> Arc<Self> ⓘ
Sourcepub fn pause(&self) -> bool
pub fn pause(&self) -> bool
Pause new-job dispatch. Returns true iff this call flipped the state
(was running); idempotent repeat pauses return false so the route can
suppress a duplicate queue_paused event.
Sourcepub fn resume(&self) -> bool
pub fn resume(&self) -> bool
Resume dispatch and wake every gated loop. Returns true iff this call
flipped the state (was paused).
pub fn is_paused(&self) -> bool
Sourcepub async fn wait_if_paused(&self)
pub async fn wait_if_paused(&self)
Park the caller while paused, returning as soon as dispatch is resumed
(immediately when not paused). Registers the wakeup before the second
flag check so a concurrent resume()’s notify_waiters() can’t slip
between the check and the await — the classic lost-wakeup race — and
re-loops in case of a spurious wake.
Auto Trait Implementations§
impl !Freeze for QueuePause
impl RefUnwindSafe for QueuePause
impl Send for QueuePause
impl Sync for QueuePause
impl Unpin for QueuePause
impl UnsafeUnpin for QueuePause
impl UnwindSafe for QueuePause
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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