More logging
This commit is contained in:
parent
5536f9638a
commit
1c8f3da8d0
2 changed files with 5 additions and 4 deletions
5
src/cache/fs.rs
vendored
5
src/cache/fs.rs
vendored
|
@ -106,8 +106,8 @@ pub(super) async fn read_file(
|
||||||
// else, just directly read from file.
|
// else, just directly read from file.
|
||||||
if let Some(key) = ENCRYPTION_KEY.get() {
|
if let Some(key) = ENCRYPTION_KEY.get() {
|
||||||
let mut header_bytes = [0; HEADERBYTES];
|
let mut header_bytes = [0; HEADERBYTES];
|
||||||
if file.read_exact(&mut header_bytes).await.is_err() {
|
if let Err(e) = file.read_exact(&mut header_bytes).await {
|
||||||
warn!("Found file, but encrypted header was not found. Assuming corrupted!");
|
warn!("Found file but failed reading header: {}", e);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ pub(super) async fn read_file(
|
||||||
|
|
||||||
parsed_metadata.map(|metadata| Ok((stream, maybe_header, metadata)))
|
parsed_metadata.map(|metadata| Ok((stream, maybe_header, metadata)))
|
||||||
} else {
|
} else {
|
||||||
|
debug!("Reader was invalid, file is corrupt");
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use base64::DecodeError;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use futures::{Stream, TryStreamExt};
|
use futures::{Stream, TryStreamExt};
|
||||||
use log::{debug, error, info, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use prometheus::{Encoder, TextEncoder};
|
use prometheus::{Encoder, TextEncoder};
|
||||||
use reqwest::{Client, StatusCode};
|
use reqwest::{Client, StatusCode};
|
||||||
|
@ -347,7 +347,7 @@ fn construct_response(
|
||||||
data: impl Stream<Item = Result<Bytes, UpstreamError>> + Unpin + 'static,
|
data: impl Stream<Item = Result<Bytes, UpstreamError>> + Unpin + 'static,
|
||||||
metadata: &ImageMetadata,
|
metadata: &ImageMetadata,
|
||||||
) -> ServerResponse {
|
) -> ServerResponse {
|
||||||
debug!("Constructing response");
|
trace!("Constructing response");
|
||||||
|
|
||||||
let mut resp = HttpResponse::Ok();
|
let mut resp = HttpResponse::Ok();
|
||||||
if let Some(content_type) = metadata.content_type {
|
if let Some(content_type) = metadata.content_type {
|
||||||
|
|
Loading…
Reference in a new issue