huskies: merge 1132 story Chat-bot proxy reads stale gateway_project_urls BTreeMap instead of live store (1122 missed this seam)

This commit is contained in:
dave
2026-05-18 00:02:37 +00:00
parent ec3216072d
commit 70797753df
8 changed files with 88 additions and 58 deletions
-3
View File
@@ -504,7 +504,6 @@ pub type ActiveProject = std::sync::Arc<tokio::sync::RwLock<String>>;
pub fn spawn_gateway_bot(
config_dir: &Path,
active_project: ActiveProject,
gateway_project_urls: BTreeMap<String, String>,
gateway_projects_store: std::sync::Arc<tokio::sync::RwLock<BTreeMap<String, ProjectEntry>>>,
port: u16,
gateway_event_tx: Option<tokio::sync::broadcast::Sender<super::GatewayStatusEvent>>,
@@ -577,7 +576,6 @@ pub fn spawn_gateway_bot(
services,
shutdown_rx,
Some(active_project),
gateway_project_urls,
Some(gateway_projects_store),
timer_store,
gateway_event_rx,
@@ -608,7 +606,6 @@ mod tests {
let (handle, shutdown_tx) = spawn_gateway_bot(
tmp.path(),
active,
std::collections::BTreeMap::new(),
projects_store,
3001,
Some(event_tx),
-9
View File
@@ -673,18 +673,9 @@ pub async fn save_bot_config_and_restart(state: &GatewayState, content: &str) ->
if let Some(h) = handle.take() {
h.abort();
}
let gateway_project_urls: BTreeMap<String, String> = state
.projects
.read()
.await
.iter()
.filter_map(|(name, entry)| entry.url.as_ref().map(|u| (name.clone(), u.clone())))
.collect();
let (new_handle, new_shutdown_tx) = io::spawn_gateway_bot(
&state.config_dir,
Arc::clone(&state.active_project),
gateway_project_urls,
Arc::clone(&state.projects),
state.port,
Some(state.event_tx.clone()),