From f06ed353605a626a59a25f76ba5c3b23c21dea1e Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Wed, 24 Apr 2024 14:23:22 -0700 Subject: [PATCH] wip: wait for flakehub pushes before shutting down? --- magic-nix-cache/src/api.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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`