Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions crates/mvr-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ pub async fn run_server(

println!("🚀 Server started successfully on port {}", api_port);

let _handle = tokio::spawn(async move {
let _ = metrics.run().await;
});
// Start the metrics service - must keep the Service alive or it aborts
let _metrics_service = metrics.run().await?;

axum::serve(listener, app)
.with_graceful_shutdown(async move {
cancellation_token.cancelled().await;
})
.await?;

// _metrics_service is dropped here, cleaning up the metrics server

Ok(())
}

Expand Down
Loading