fn handle_interactive_sessions(&self, interactive_sessions: &[InteractiveSession]) -> bool {
        DETECTED_ACTIVE_USERS.set(interactive_sessions.len() as i64);
        log::trace!(
            "handling interactive sessions, total: {}",
            interactive_sessions.len()
        );

        // Happy path, nobody to wait for.
        if interactive_sessions.is_empty() {
            log::debug!("no interactive sessions detected");
            return true;
        }

        let (release, postponements_remaining) = match self {
            UpdateAgentMachineState::UpdateStaged((r, p)) => (r, *p),
            _ => unreachable!(
                "transition not allowed: handle_interactive_sessions on {:?}",
                self,
            ),
        };

        // Maximum grace period reached, not delaying any further.
        if postponements_remaining == 0 {
            log::warn!("reached end of grace period while waiting for interactive sessions");
            return true;
        }

        if postponements_remaining == MAX_FINALIZE_POSTPONEMENTS {
            let max_reboot_delay_secs =
                DEFAULT_POSTPONEMENT_TIME_SECS.saturating_mul(MAX_FINALIZE_POSTPONEMENTS as u64);
            log::warn!(
                "interactive sessions detected, entering grace period (maximum {})",
                format_seconds(max_reboot_delay_secs)
            );
            let warning_msg = format_reboot_warning(max_reboot_delay_secs, &release.version);
            broadcast(&warning_msg, interactive_sessions);
        } else if postponements_remaining == 1 {
            log::warn!("last attempt to wait for the end of all interactive sessions");
            let warning_msg =
                format_reboot_warning(DEFAULT_POSTPONEMENT_TIME_SECS, &release.version);
            broadcast(&warning_msg, interactive_sessions);
        }

        false
    }
/// Helper for determining whether to allow a finalization by first checking whether
/// interactive sessions are present and then handling the appropriate response to current
/// state's remaining postponements (possibly broadcasting warning messages to active sessions).
///
/// Returns a boolean indicating whether finalization is permitted.
Helper for determining whether to allow a finalization by first checking whether
interactive sessions are present and then handling the appropriate response to current
state's remaining postponements (possibly broadcasting warning messages to active sessions).

Returns a boolean indicating whether finalization is permitted.
Helper for determining whether to allow a finalization by first checking whether interactive sessions are present and then handling the appropriate response to current state ' s remaining postponements ( possibly broadcasting warning messages to active sessions ) . Returns a boolean indicating whether finalization is permitted .
fn handle_interactive_sessions(&self, interactive_sessions: &[InteractiveSession]) -> bool {
        DETECTED_ACTIVE_USERS.set(interactive_sessions.len() as i64);
        log::trace!(
            "handling interactive sessions, total: {}",
            interactive_sessions.len()
        );
        // Happy path, nobody to wait for.
        if interactive_sessions.is_empty() {
            log::debug!("no interactive sessions detected");
            return true;
        }
        let (release, postponements_remaining) = match self {
            UpdateAgentMachineState::UpdateStaged((r, p)) => (r, *p),
            _ => unreachable!(
                "transition not allowed: handle_interactive_sessions on {:?}",
                self,
            ),
        };
        // Maximum grace period reached, not delaying any further.
        if postponements_remaining == 0 {
            log::warn!("reached end of grace period while waiting for interactive sessions");
            return true;
        }
        if postponements_remaining == MAX_FINALIZE_POSTPONEMENTS {
            let max_reboot_delay_secs =
                DEFAULT_POSTPONEMENT_TIME_SECS.saturating_mul(MAX_FINALIZE_POSTPONEMENTS as u64);
            log::warn!(
                "interactive sessions detected, entering grace period (maximum {})",
                format_seconds(max_reboot_delay_secs)
            );
            let warning_msg = format_reboot_warning(max_reboot_delay_secs, &release.version);
            broadcast(&warning_msg, interactive_sessions);
        } else if postponements_remaining == 1 {
            log::warn!("last attempt to wait for the end of all interactive sessions");
            let warning_msg =
                format_reboot_warning(DEFAULT_POSTPONEMENT_TIME_SECS, &release.version);
            broadcast(&warning_msg, interactive_sessions);
        }
        false
    }
fn handle_interactive_sessions ( & self , interactive_sessions : & [ InteractiveSession ] ) -> bool { DETECTED_ACTIVE_USERS . set ( interactive_sessions . len ( ) as i64 ) ; log :: trace ! ( " " interactive_sessions len ( ) ) ; // Happy path, nobody to wait for. if interactive_sessions . is_empty ( ) { log :: debug ! ( " " ) ; return true ; } let ( release , postponements_remaining ) = match self { UpdateAgentMachineState :: UpdateStaged ( ( r , p ) ) => ( r , * p ) , _ => unreachable ! ( " " self ) , } ; // Maximum grace period reached, not delaying any further. if postponements_remaining == 0 { log :: warn ! ( " " ) ; return true ; } if postponements_remaining == MAX_FINALIZE_POSTPONEMENTS { let max_reboot_delay_secs = DEFAULT_POSTPONEMENT_TIME_SECS . saturating_mul ( MAX_FINALIZE_POSTPONEMENTS as u64 ) ; log :: warn ! ( " " format_seconds ( max_reboot_delay_secs ) ) ; let warning_msg = format_reboot_warning ( max_reboot_delay_secs , & release . version ) ; broadcast ( & warning_msg , interactive_sessions ) ; } else if postponements_remaining == 1 { log :: warn ! ( " " ) ; let warning_msg = format_reboot_warning ( DEFAULT_POSTPONEMENT_TIME_SECS , & release . version ) ; broadcast ( & warning_msg , interactive_sessions ) ; } false }
Helper for determining whether to allow a finalization by first checking whether
interactive sessions are present and then handling the appropriate response to current
state's remaining postponements (possibly broadcasting warning messages to active sessions).
Helper for determining whether to allow a finalization by first checking whether interactive sessions are present and then handling the appropriate response to current state ' s remaining postponements ( possibly broadcasting warning messages to active sessions ) .
&self
interactive_sessions
&[InteractiveSession]