mirror of
https://github.com/zhaofengli/attic.git
synced 2024-12-14 11:57:30 +00:00
Merge pull request #154 from cole-h/fixup-stream-error-logging
fixup: stream error logging
This commit is contained in:
commit
e127acbf9a
1 changed files with 7 additions and 7 deletions
|
@ -18,7 +18,7 @@ use axum::{
|
|||
Router,
|
||||
};
|
||||
use futures::stream::BoxStream;
|
||||
use http_body_util::BodyExt;
|
||||
use futures::TryStreamExt as _;
|
||||
use serde::Serialize;
|
||||
use tokio_util::io::ReaderStream;
|
||||
use tracing::instrument;
|
||||
|
@ -217,11 +217,11 @@ async fn get_nar(
|
|||
match storage.download_file_db(remote_file, false).await? {
|
||||
Download::Url(url) => Ok(Redirect::temporary(&url).into_response()),
|
||||
Download::AsyncRead(stream) => {
|
||||
let stream = ReaderStream::new(stream);
|
||||
let body = Body::from_stream(stream).map_err(|e| {
|
||||
let stream = ReaderStream::new(stream).map_err(|e| {
|
||||
tracing::error!("Stream error: {e}");
|
||||
e
|
||||
}).into_inner();
|
||||
});
|
||||
let body = Body::from_stream(stream);
|
||||
|
||||
Ok(body.into_response())
|
||||
}
|
||||
|
@ -254,11 +254,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 = Body::from_stream(merged).map_err(|e| {
|
||||
let merged = merge_chunks(chunks, streamer, storage, 2).map_err(|e| {
|
||||
tracing::error!("Stream error: {e}");
|
||||
e
|
||||
}).into_inner();
|
||||
});
|
||||
let body = Body::from_stream(merged);
|
||||
|
||||
Ok(body.into_response())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue