Read CI log files asynchronously
The synchronous fs_err::read_to_string call blocked the tokio worker
for the duration of each log read inside the async run_detail handler.
Enable fs-err's tokio feature and await the read instead. NotFound is
silenced to preserve the prior "log not yet written" behavior.

Assisted-by: Claude Opus 4.7 via Claude Code
change mvnzvooorlnwzrqxnqtzmotsmrxzqopm
commit a27b9ec93da3f4aed5d02f0130ad43ffa764927e
author Alpha Chen <alpha@kejadlen.dev>
date
parent mqzzluos
diff --git a/Cargo.lock b/Cargo.lock
index a21054c..2fc4434 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -846,6 +846,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "73fde052dbfc920003cfd2c8e2c6e6d4cc7c1091538c3a24226cec0665ab08c0"
 dependencies = [
  "autocfg",
+ "tokio",
 ]
 
 [[package]]
diff --git a/Cargo.toml b/Cargo.toml
index b7a582f..dc57f11 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ askama = "*"
 axum = "*"
 clap = { version = "*", features = ["derive", "env"] }
 clap_complete = "*"
-fs-err = "*"
+fs-err = { version = "*", features = ["tokio"] }
 jiff = { version = "*", features = ["serde"] }
 miette = { version = "*", features = ["fancy"] }
 mlua = { version = "*", features = ["lua54", "serde", "vendored", "error-send"] }
diff --git a/src/quire/web/handlers.rs b/src/quire/web/handlers.rs
index 115eff8..a2b6893 100644
--- a/src/quire/web/handlers.rs
+++ b/src/quire/web/handlers.rs
@@ -129,14 +129,13 @@ pub async fn run_detail(
             .join("jobs")
             .join(&ev.job_id)
             .join(format!("sh-{sh_n}.log"));
-        if log_path.exists() {
-            match fs_err::read_to_string(&log_path) {
-                Ok(content) => {
-                    log_contents.insert(key, content);
-                }
-                Err(e) => {
-                    tracing::warn!(path = %log_path.display(), error = %e, "failed to read CRI log");
-                }
+        match fs_err::tokio::read_to_string(&log_path).await {
+            Ok(content) => {
+                log_contents.insert(key, content);
+            }
+            Err(e) if e.kind() == std::io::ErrorKind::NotFound => {}
+            Err(e) => {
+                tracing::warn!(path = %log_path.display(), error = %e, "failed to read CRI log");
             }
         }
     }