diff --git a/src/agent/mod.rs b/src/agent/mod.rs index 54bc418..a31a82c 100644 --- a/src/agent/mod.rs +++ b/src/agent/mod.rs @@ -42,6 +42,17 @@ pub struct ActivityGuard { id: u64, } +impl ActivityGuard { + pub async fn update(&self, label: impl Into) { + let label = label.into(); + let mut st = self.agent.state.lock().await; + if let Some(entry) = st.activities.iter_mut().find(|a| a.id == self.id) { + entry.label = label; + } + st.changed.notify_one(); + } +} + const ACTIVITY_LINGER: std::time::Duration = std::time::Duration::from_secs(5); impl Drop for ActivityGuard {