huskies: merge 1106 story Chat bootstrap Phase 1: new project chat command spawns a bare project container and registers it with the gateway
This commit is contained in:
@@ -500,11 +500,13 @@ pub type ActiveProject = std::sync::Arc<tokio::sync::RwLock<String>>;
|
||||
/// Returns `(abort_handle, shutdown_tx)`. The caller **must** hold
|
||||
/// `shutdown_tx` for the bot's lifetime and send `Some(ShutdownReason)` on it
|
||||
/// before process exit so the bot can announce "going offline" to its rooms.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn spawn_gateway_bot(
|
||||
config_dir: &Path,
|
||||
active_project: ActiveProject,
|
||||
gateway_projects: Vec<String>,
|
||||
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>>,
|
||||
perm_rx: std::sync::Arc<
|
||||
@@ -578,6 +580,7 @@ pub fn spawn_gateway_bot(
|
||||
Some(active_project),
|
||||
gateway_projects,
|
||||
gateway_project_urls,
|
||||
Some(gateway_projects_store),
|
||||
timer_store,
|
||||
gateway_event_rx,
|
||||
);
|
||||
@@ -602,11 +605,14 @@ mod tests {
|
||||
let (_perm_tx, perm_rx) =
|
||||
tokio::sync::mpsc::unbounded_channel::<crate::http::context::PermissionForward>();
|
||||
let perm_rx = std::sync::Arc::new(tokio::sync::Mutex::new(perm_rx));
|
||||
let projects_store =
|
||||
std::sync::Arc::new(tokio::sync::RwLock::new(std::collections::BTreeMap::new()));
|
||||
let (handle, shutdown_tx) = spawn_gateway_bot(
|
||||
tmp.path(),
|
||||
active,
|
||||
vec!["proj".to_string()],
|
||||
std::collections::BTreeMap::new(),
|
||||
projects_store,
|
||||
3001,
|
||||
Some(event_tx),
|
||||
perm_rx,
|
||||
|
||||
Reference in New Issue
Block a user