huskies: merge 762
This commit is contained in:
@@ -31,6 +31,9 @@ pub async fn run_bot(
|
||||
gateway_projects: Vec<String>,
|
||||
gateway_project_urls: std::collections::BTreeMap<String, String>,
|
||||
timer_store: Arc<TimerStore>,
|
||||
gateway_event_rx: Option<
|
||||
tokio::sync::broadcast::Receiver<crate::service::gateway::GatewayStatusEvent>,
|
||||
>,
|
||||
) -> Result<(), String> {
|
||||
let project_root = &services.project_root;
|
||||
let store_path = project_root.join(".huskies").join("matrix_store");
|
||||
@@ -322,6 +325,22 @@ pub async fn run_bot(
|
||||
);
|
||||
}
|
||||
|
||||
// In gateway mode, subscribe to the gateway-side status broadcaster and
|
||||
// forward events to the configured Matrix rooms with a `[project-name]` prefix.
|
||||
// This path delivers events pushed directly by project nodes over WebSocket
|
||||
// (via `/gateway/events/push`), complementing the HTTP-polling path above.
|
||||
// On broadcaster back-pressure (Lagged), the task re-subscribes automatically
|
||||
// so it never permanently stalls.
|
||||
if let Some(event_rx) = gateway_event_rx {
|
||||
let broadcast_room_ids: Vec<String> =
|
||||
announce_room_ids.iter().map(|r| r.to_string()).collect();
|
||||
crate::gateway::spawn_gateway_broadcaster_forwarder(
|
||||
Arc::clone(&transport),
|
||||
broadcast_room_ids,
|
||||
event_rx,
|
||||
);
|
||||
}
|
||||
|
||||
// Spawn a shutdown watcher that sends a best-effort goodbye message to all
|
||||
// configured rooms when the server is about to stop (SIGINT/SIGTERM or rebuild).
|
||||
{
|
||||
|
||||
@@ -71,6 +71,9 @@ pub fn spawn_bot(
|
||||
gateway_projects: Vec<String>,
|
||||
gateway_project_urls: std::collections::BTreeMap<String, String>,
|
||||
timer_store: Arc<TimerStore>,
|
||||
gateway_event_rx: Option<
|
||||
tokio::sync::broadcast::Receiver<crate::service::gateway::GatewayStatusEvent>,
|
||||
>,
|
||||
) -> Option<tokio::task::AbortHandle> {
|
||||
let config = match BotConfig::load(project_root) {
|
||||
Some(c) => c,
|
||||
@@ -109,6 +112,7 @@ pub fn spawn_bot(
|
||||
gateway_projects,
|
||||
gateway_project_urls,
|
||||
timer_store,
|
||||
gateway_event_rx,
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user