diff --git a/magic-nix-cache/src/api.rs b/magic-nix-cache/src/api.rs index 104d7f1..35ae65e 100644 --- a/magic-nix-cache/src/api.rs +++ b/magic-nix-cache/src/api.rs @@ -99,17 +99,17 @@ async fn workflow_finish( gha_cache.shutdown().await?; } + if let Some(attic_state) = state.flakehub_state.write().await.take() { + tracing::info!("Waiting for FlakeHub cache uploads to finish"); + let _paths = attic_state.push_session.wait().await?; + } + if let Some(sender) = state.shutdown_sender.lock().await.take() { sender .send(()) .map_err(|_| Error::Internal("Sending shutdown server message".to_owned()))?; } - if let Some(attic_state) = state.flakehub_state.write().await.take() { - tracing::info!("Waiting for FlakeHub cache uploads to finish"); - let _paths = attic_state.push_session.wait().await?; - } - // NOTE(cole-h): see `init_logging` if let Some(logfile) = &state.logfile { let logfile_contents = std::fs::read_to_string(logfile)