Fix error when none of S3/K2V/WEB/ADMIN server is started (fix #613)

This commit is contained in:
Alex Auvolat 2023-09-12 14:35:19 +02:00
parent 143a349f55
commit aa79810596

View File

@ -130,6 +130,11 @@ pub async fn run_server(config_file: PathBuf, secrets: Secrets) -> Result<(), Er
warn!("This Garage version is built without the metrics feature"); warn!("This Garage version is built without the metrics feature");
} }
if servers.is_empty() {
// Nothing runs except netapp (not in servers)
// Await shutdown signal before proceeding to shutting down netapp
wait_from(watch_cancel).await;
} else {
// Stuff runs // Stuff runs
// When a cancel signal is sent, stuff stops // When a cancel signal is sent, stuff stops
@ -142,8 +147,10 @@ pub async fn run_server(config_file: PathBuf, secrets: Secrets) -> Result<(), Er
info!("{} server exited without error.", desc); info!("{} server exited without error.", desc);
} }
} }
}
// Remove RPC handlers for system to break reference cycles // Remove RPC handlers for system to break reference cycles
info!("Deregistering RPC handlers for shutdown...");
garage.system.netapp.drop_all_handlers(); garage.system.netapp.drop_all_handlers();
opentelemetry::global::shutdown_tracer_provider(); opentelemetry::global::shutdown_tracer_provider();