diff --git a/crates/steep-server/src/event_bus.rs b/crates/steep-server/src/event_bus.rs index 0c03799..ca7f443 100644 --- a/crates/steep-server/src/event_bus.rs +++ b/crates/steep-server/src/event_bus.rs @@ -1,5 +1,5 @@ use std::collections::{HashMap, VecDeque}; -use std::sync::{Arc, Mutex, RwLock}; +use std::sync::{Arc, Mutex}; use serde::Serialize; use tokio::sync::broadcast; @@ -13,7 +13,7 @@ const MAX_EVENT_ARGUMENTS: usize = 200; /// Lifecycle event of a job, broadcast globally. #[derive(Clone, Debug, Serialize)] -#[serde(tag = "type", rename_all = "snake_case")] +#[serde(rename_all = "snake_case")] pub enum JobEvent { Queued { id: u64, @@ -46,7 +46,7 @@ pub enum JobEvent { } #[derive(Clone, Debug, Serialize)] -#[serde(tag = "type", rename_all = "snake_case")] +#[serde(rename_all = "snake_case")] pub enum Progress { ToolCall { iteration: usize, @@ -98,7 +98,7 @@ pub struct JobSubscription { #[derive(Clone)] pub struct EventBus { lifecycle: broadcast::Sender, - jobs: Arc>>>, + jobs: Arc>>>, } impl EventBus { @@ -107,7 +107,7 @@ impl EventBus { Self { lifecycle, - jobs: Arc::new(RwLock::new(HashMap::new())), + jobs: Arc::new(Mutex::new(HashMap::new())), } } @@ -127,7 +127,7 @@ impl EventBus { }); self.jobs - .write() + .lock() .expect("job registry lock poisoned") .insert(id, channel.clone()); @@ -162,7 +162,7 @@ impl EventBus { if let Some(channel) = self .jobs - .write() + .lock() .expect("job registry lock poisoned") .remove(&id) { @@ -181,7 +181,7 @@ impl EventBus { pub fn subscribe_job(&self, id: u64) -> Option { let channel = self .jobs - .read() + .lock() .expect("job registry lock poisoned") .get(&id) .cloned()?;