diff options
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/dashboard/mod.rs | 5 | ||||
| -rw-r--r-- | src/api/mod.rs | 13 |
2 files changed, 5 insertions, 13 deletions
diff --git a/src/api/dashboard/mod.rs b/src/api/dashboard/mod.rs index f0cbbfd..0a502a3 100644 --- a/src/api/dashboard/mod.rs +++ b/src/api/dashboard/mod.rs @@ -381,8 +381,9 @@ fn merge_patch(old: &JsonValue, new: &JsonValue) -> Option<JsonValue> { } /// The dashboard's routes (authenticated, as the rest of `/admin`), with their hub. -/// `closing` turns true when the node stops (`Hub::closing`). -pub(crate) fn router(state: AppState, closing: watch::Receiver<bool>) -> Router<AppState> { +pub(crate) fn router(state: AppState) -> Router<AppState> { + // Its streams end when the node shuts down (`AppState::closing`). + let closing = state.closing.subscribe(); Router::new() .route("/admin/dashboard", get(page_html)) .route("/admin/dashboard/state", get(current_state)) diff --git a/src/api/mod.rs b/src/api/mod.rs index 1f178e7..58967f3 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -35,14 +35,7 @@ use crate::state::AppState; /// Builds the complete HTTP router. Everything except the API description (`/swagger-ui`, /// `/openapi.yaml`), `/health` and `/ready` is authenticated. -/// `closing` turns true when the node stops: long-lived responses (the dashboard's -/// events) end then. -pub(crate) fn router( - state: AppState, - auth_state: AuthState, - debug_api: bool, - closing: tokio::sync::watch::Receiver<bool>, -) -> Router { +pub(crate) fn router(state: AppState, auth_state: AuthState, debug_api: bool) -> Router { let mut api: Router<AppState> = Router::new() .route("/store", get(store::get_store_root)) .route( @@ -67,10 +60,8 @@ pub(crate) fn router( #[cfg(feature = "dashboard")] { - api = api.merge(dashboard::router(state.clone(), closing)); + api = api.merge(dashboard::router(state.clone())); } - #[cfg(not(feature = "dashboard"))] - let _ = closing; if debug_api { warn!("Debug API enabled"); |
