//! Agent metadata advances the existing console publisher by a signal.
use super::{ConsoleError, ConsoleHub};
impl ConsoleHub {
/// Makes a real metadata change due without inventing a worker or a flow.
///
/// # Errors
/// The topology lock or revision counter is unavailable.
pub fn agent_changed(&self) -> Result<(), ConsoleError> {
let mut state = self.lock_topology()?;
let next = state
.model
.rev()
.checked_add(1)
.ok_or(ConsoleError::TopologyRevisionOverflow)?;
state.model.ensure_revision(next);
state.stale = true;
let due = state.subscribers > 0;
drop(state);
if due {
self.wake();
}
Ok(())
}
}