diff options
author | Alex <alex@adnab.me> | 2023-09-12 12:54:50 +0000 |
---|---|---|
committer | Alex <alex@adnab.me> | 2023-09-12 12:54:50 +0000 |
commit | be1a16b42b173779c2457d11e489ea13952a9eae (patch) | |
tree | 4ab75c134805d73c5b1cf8121b7dcb551303b452 /src/garage | |
parent | 143a349f55b0c652d407019c5850313b0c95ccbd (diff) | |
parent | 91e764a2bf7a479a068fdfdad020cd79b5e86b88 (diff) | |
download | garage-be1a16b42b173779c2457d11e489ea13952a9eae.tar.gz garage-be1a16b42b173779c2457d11e489ea13952a9eae.zip |
Merge pull request 'Fix multiple shutdown issues' (#633) from fix-shutdown into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/633
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/server.rs | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/garage/server.rs b/src/garage/server.rs index 958089c6..472616c7 100644 --- a/src/garage/server.rs +++ b/src/garage/server.rs @@ -130,20 +130,27 @@ pub async fn run_server(config_file: PathBuf, secrets: Secrets) -> Result<(), Er warn!("This Garage version is built without the metrics feature"); } - // Stuff runs - - // When a cancel signal is sent, stuff stops - - // Collect stuff - for (desc, join_handle) in servers { - if let Err(e) = join_handle.await? { - error!("{} server exited with error: {}", desc, e); - } else { - info!("{} server exited without error.", desc); + 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 + + // When a cancel signal is sent, stuff stops + + // Collect stuff + for (desc, join_handle) in servers { + if let Err(e) = join_handle.await? { + error!("{} server exited with error: {}", desc, e); + } else { + info!("{} server exited without error.", desc); + } } } // Remove RPC handlers for system to break reference cycles + info!("Deregistering RPC handlers for shutdown..."); garage.system.netapp.drop_all_handlers(); opentelemetry::global::shutdown_tracer_provider(); |