diff --git a/magic-nix-cache/src/api.rs b/magic-nix-cache/src/api.rs index e8d8919..702a1dd 100644 --- a/magic-nix-cache/src/api.rs +++ b/magic-nix-cache/src/api.rs @@ -45,16 +45,16 @@ async fn workflow_finish( gha_cache.shutdown().await?; } + // Wait for the Attic push workers to finish. + if let Some(attic_state) = state.flakehub_state.write().await.take() { + tracing::info!("Waiting for FlakeHub cache uploads to finish"); + 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()))?; - - // Wait for the Attic push workers to finish. - if let Some(attic_state) = state.flakehub_state.write().await.take() { - tracing::info!("Waiting for FlakeHub cache uploads to finish"); - attic_state.push_session.wait().await?; - } } // NOTE(cole-h): see `init_logging`