pub(crate) async fn run_lifecycle_manager<P: Persister>(
    mut manager: LifecycleManager,
    persister: Arc<P>,
    shutdown: CancellationToken,
    poison_cabinet: Arc<PoisonCabinet>,
) {
    loop {
        if poison_cabinet.contains(&PoisonPill::LifecyclePanic) {
            panic!("Lifecycle manager poisened, panic");
        }
        if poison_cabinet.contains(&PoisonPill::LifecycleExit) {
            error!("Lifecycle manager poisened, exit early");
            return;
        }

        if shutdown.is_cancelled() {
            info!("Lifecycle manager shutdown");
            return;
        }

        manager.maybe_persist(&persister).await;

        manager.job_registry.reclaim();

        tokio::select!(
            _ = tokio::time::sleep(CHECK_INTERVAL) => {},
            _ = shutdown.cancelled() => {},
        );
    }
}
/// Runs the lifecycle manager to trigger persistence every second.
Runs the lifecycle manager to trigger persistence every second.
Runs the lifecycle manager to trigger persistence every second .
pub(crate) async fn run_lifecycle_manager<P: Persister>(
    mut manager: LifecycleManager,
    persister: Arc<P>,
    shutdown: CancellationToken,
    poison_cabinet: Arc<PoisonCabinet>,
) {
    loop {
        if poison_cabinet.contains(&PoisonPill::LifecyclePanic) {
            panic!("Lifecycle manager poisened, panic");
        }
        if poison_cabinet.contains(&PoisonPill::LifecycleExit) {
            error!("Lifecycle manager poisened, exit early");
            return;
        }
        if shutdown.is_cancelled() {
            info!("Lifecycle manager shutdown");
            return;
        }
        manager.maybe_persist(&persister).await;
        manager.job_registry.reclaim();
        tokio::select!(
            _ = tokio::time::sleep(CHECK_INTERVAL) => {},
            _ = shutdown.cancelled() => {},
        );
    }
}
pub ( crate ) async fn run_lifecycle_manager < P : Persister > ( mut manager : LifecycleManager , persister : Arc < P > , shutdown : CancellationToken , poison_cabinet : Arc < PoisonCabinet > , ) { loop { if poison_cabinet . contains ( & PoisonPill :: LifecyclePanic ) { panic ! ( " " ) ; } if poison_cabinet . contains ( & PoisonPill :: LifecycleExit ) { error ! ( " " ) ; return ; } if shutdown . is_cancelled ( ) { info ! ( " " ) ; return ; } manager . maybe_persist ( & persister ) . await ; manager . job_registry . reclaim ( ) ; tokio :: select ! ( tokio time sleep ( CHECK_INTERVAL ) { } shutdown cancelled ( ) { } ) ; } }
Runs the lifecycle manager to trigger persistence every second.
Runs the lifecycle manager to trigger persistence every second .
manager
LifecycleManager
persister
Arc<P>
shutdown
CancellationToken
poison_cabinet
Arc<PoisonCabinet>
manager
LifecycleManager
persister
Arc<P>
shutdown
CancellationToken
poison_cabinet
Arc<PoisonCabinet>