Log stream errors
This commit is contained in:
parent
4dbdbee457
commit
a4f2cae9dd
|
@ -9,6 +9,7 @@ use std::io::{Error as IoError, ErrorKind as IoErrorKind};
|
|||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::body::HttpBody as _;
|
||||
use axum::{
|
||||
body::StreamBody,
|
||||
extract::{Extension, Path},
|
||||
|
@ -217,7 +218,11 @@ async fn get_nar(
|
|||
Download::Url(url) => Ok(Redirect::temporary(&url).into_response()),
|
||||
Download::AsyncRead(stream) => {
|
||||
let stream = ReaderStream::new(stream);
|
||||
let body = StreamBody::new(stream);
|
||||
let body = StreamBody::new(stream).map_err(|e| {
|
||||
tracing::error!("Stream error: {e}");
|
||||
e
|
||||
});
|
||||
|
||||
Ok(body.into_response())
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +255,11 @@ async fn get_nar(
|
|||
// TODO: Make num_prefetch configurable
|
||||
// The ideal size depends on the average chunk size
|
||||
let merged = merge_chunks(chunks, streamer, storage, 2);
|
||||
let body = StreamBody::new(merged);
|
||||
let body = StreamBody::new(merged).map_err(|e| {
|
||||
tracing::error!("Stream error: {e}");
|
||||
e
|
||||
});
|
||||
|
||||
Ok(body.into_response())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue