more debug logging, truncate the log file when we init logging

This commit is contained in:
Cole Helbling 2024-05-07 11:11:39 -07:00
parent 3bc019d996
commit a9f32f83dd
2 changed files with 7 additions and 3 deletions

View file

@ -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<State>,
Json(req): Json<EnqueuePathsRequest>,
@ -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?;
}

View file

@ -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<tracing_appender::non_blocking::WorkerGuard> {
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()