pub struct CleanupWorker { /* private fields */ }Implementations§
Source§impl CleanupWorker
impl CleanupWorker
pub fn new(storage: Arc<dyn Storage>, interval: Duration) -> Self
Sourcepub async fn run_until_cancelled(&self, cancel: CancellationToken) -> Result<()>
pub async fn run_until_cancelled(&self, cancel: CancellationToken) -> Result<()>
Run the cleanup loop until cancel fires.
Sourcepub async fn sweep_once(&self) -> Result<usize>
pub async fn sweep_once(&self) -> Result<usize>
One cleanup sweep. Exposed for tests.
Two pieces of work, in order:
- Delete jobs whose
expires_athas passed (final-state sweep). - Delete generic named locks whose
expires_athas passed.
Both share a single now so a tick is consistent. Returns the
number of expired jobs removed (preserved for backward
compatibility with the existing test); named-lock removal is
logged but doesn’t change the return.
Auto Trait Implementations§
impl Freeze for CleanupWorker
impl !RefUnwindSafe for CleanupWorker
impl Send for CleanupWorker
impl Sync for CleanupWorker
impl Unpin for CleanupWorker
impl UnsafeUnpin for CleanupWorker
impl !UnwindSafe for CleanupWorker
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