A fork of attic a self-hostable Nix Binary Cache server
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #137 from cole-h/log-stream-errors

Log stream errors

authored by

Zhaofeng Li and committed by
GitHub
05582693 3907b311

+11 -2
+11 -2
server/src/api/binary_cache.rs
··· 9 9 use std::path::PathBuf; 10 10 use std::sync::Arc; 11 11 12 + use axum::body::HttpBody as _; 12 13 use axum::{ 13 14 body::StreamBody, 14 15 extract::{Extension, Path}, ··· 217 218 Download::Url(url) => Ok(Redirect::temporary(&url).into_response()), 218 219 Download::AsyncRead(stream) => { 219 220 let stream = ReaderStream::new(stream); 220 - let body = StreamBody::new(stream); 221 + let body = StreamBody::new(stream).map_err(|e| { 222 + tracing::error!("Stream error: {e}"); 223 + e 224 + }); 225 + 221 226 Ok(body.into_response()) 222 227 } 223 228 } ··· 250 255 // TODO: Make num_prefetch configurable 251 256 // The ideal size depends on the average chunk size 252 257 let merged = merge_chunks(chunks, streamer, storage, 2); 253 - let body = StreamBody::new(merged); 258 + let body = StreamBody::new(merged).map_err(|e| { 259 + tracing::error!("Stream error: {e}"); 260 + e 261 + }); 262 + 254 263 Ok(body.into_response()) 255 264 } 256 265 }