From a9f32f83ddca295b0403594843dd46837bf0ff6c Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Tue, 7 May 2024 11:11:39 -0700 Subject: [PATCH] more debug logging, truncate the log file when we init logging --- magic-nix-cache/src/api.rs | 5 ++++- magic-nix-cache/src/main.rs | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/magic-nix-cache/src/api.rs b/magic-nix-cache/src/api.rs index 9e35da6..02e4bc3 100644 --- a/magic-nix-cache/src/api.rs +++ b/magic-nix-cache/src/api.rs @@ -53,7 +53,8 @@ async fn workflow_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?; + let paths = attic_state.push_session.wait().await?; + tracing::warn!(?paths, "pushed these paths"); } // NOTE(cole-h): see `init_logging` @@ -78,6 +79,7 @@ pub struct EnqueuePathsRequest { pub struct EnqueuePathsResponse {} /// Schedule paths in the local Nix store for uploading. +#[tracing::instrument(skip_all)] async fn enqueue_paths( Extension(state): Extension, Json(req): Json, @@ -97,6 +99,7 @@ async fn enqueue_paths( } if let Some(flakehub_state) = &*state.flakehub_state.read().await { + tracing::warn!("enqueuing {:?} for flakehub", store_paths); crate::flakehub::enqueue_paths(flakehub_state, store_paths).await?; } diff --git a/magic-nix-cache/src/main.rs b/magic-nix-cache/src/main.rs index d35a27d..76446ae 100644 --- a/magic-nix-cache/src/main.rs +++ b/magic-nix-cache/src/main.rs @@ -20,7 +20,7 @@ mod gha; mod telemetry; use std::collections::HashSet; -use std::fs::{self, create_dir_all, OpenOptions}; +use std::fs::{self, create_dir_all}; use std::io::Write; use std::net::SocketAddr; use std::os::unix::fs::PermissionsExt; @@ -465,7 +465,8 @@ fn init_logging() -> Result { let logfile = std::env::temp_dir().join("magic-nix-cache-tracing.log"); let file = std::fs::OpenOptions::new() .create(true) - .append(true) + .write(true) + .truncate(true) .open(logfile)?; let (nonblocking, guard) = tracing_appender::non_blocking(file); let file_layer = tracing_subscriber::fmt::layer()