pub struct Messages { /* private fields */ }Expand description
Due times follow the app’s clock, so a test can move them; leases follow the database’s.
Implementations§
Source§impl Messages
impl Messages
pub fn new(db: Db) -> Self
pub async fn claim(&self, lease: Duration, limit: i64) -> Result<Vec<Claimed>>
Sourcepub async fn renew(&self, message: &Claimed, lease: Duration) -> Result<()>
pub async fn renew(&self, message: &Claimed, lease: Duration) -> Result<()>
A conflict means the claim was lost: another worker took the message after its lease ran out.
Sourcepub fn completion(&self, message: &Claimed) -> Step
pub fn completion(&self, message: &Claimed) -> Step
Committed with its job’s outcome, it makes the outcome happen once.
Sourcepub async fn retry(
&self,
message: &Claimed,
listener: Option<&str>,
error: &str,
delay: Duration,
) -> Result<()>
pub async fn retry( &self, message: &Claimed, listener: Option<&str>, error: &str, delay: Duration, ) -> Result<()>
listener names the lone listener an event ran as; the message becomes its job.
pub async fn bury( &self, message: &Claimed, listener: Option<&str>, error: &str, ) -> Result<()>
pub async fn add_schedule( &self, name: &str, first_at: Timestamp, cadence: &str, previous_cadence: &str, ) -> Result<()>
Sourcepub async fn queue_schedule(&self, name: &str) -> Result<()>
pub async fn queue_schedule(&self, name: &str) -> Result<()>
A run by hand: a running worker keeps the next due time in memory, but takes a job at once.
Sourcepub async fn fire_schedule(
&self,
name: &str,
now: Timestamp,
next_at: Timestamp,
) -> Result<Option<Fired>>
pub async fn fire_schedule( &self, name: &str, now: Timestamp, next_at: Timestamp, ) -> Result<Option<Fired>>
Only one of any number of concurrent callers is told it fired.
pub fn wakeups(&self) -> Option<BoxFuture<'_, Result<Box<dyn Wakeups>>>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Messages
impl !UnwindSafe for Messages
impl Freeze for Messages
impl Send for Messages
impl Sync for Messages
impl Unpin for Messages
impl UnsafeUnpin for Messages
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