forked from boos/BoosAPI
feat: merge opus comfyui and login updates
This commit is contained in:
+21
@@ -105,6 +105,20 @@ async fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
let comfyui_process = state.comfyui.clone();
|
||||
|
||||
// Multi-tenant ComfyUI pool: adopt any containers that survived a
|
||||
// previous API restart, then start the idle-reaper task. Only
|
||||
// wired in when the `multi_tenant_comfy` feature is on; under the
|
||||
// legacy singleton path the pool is constructed but unused, and
|
||||
// `comfyui_pool` is `None` so we skip shutdown_all on exit.
|
||||
#[cfg(feature = "multi_tenant_comfy")]
|
||||
let comfyui_pool = {
|
||||
state.comfyui_pool.reconcile_on_startup().await;
|
||||
boosapi::services::comfyui_pool::spawn_reaper(state.comfyui_pool.clone());
|
||||
Some(state.comfyui_pool.clone())
|
||||
};
|
||||
#[cfg(not(feature = "multi_tenant_comfy"))]
|
||||
let comfyui_pool: Option<std::sync::Arc<boosapi::services::comfyui_pool::ComfyUIPool>> = None;
|
||||
|
||||
// Build router
|
||||
let app = boosapi::routes::build_router(state);
|
||||
|
||||
@@ -123,6 +137,13 @@ async fn main() -> anyhow::Result<()> {
|
||||
tracing::warn!(%err, "ComfyUI embedded process did not stop cleanly");
|
||||
}
|
||||
|
||||
// Tear down any per-user ComfyUI containers we spawned. This is
|
||||
// best-effort — a hard kill of the API leaves them running and the
|
||||
// next startup will adopt them via reconcile_on_startup().
|
||||
if let Some(pool) = comfyui_pool {
|
||||
pool.shutdown_all().await;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user