debuglogs-more

This commit is contained in:
Untone 2024-11-11 14:07:25 +03:00
parent 46e485c71f
commit 5b7d84de03

View File

@ -65,7 +65,7 @@ pub async fn proxy_handler(
warn!("Processing image file with width: {}", requested_width); warn!("Processing image file with width: {}", requested_width);
if requested_width == 0 { if requested_width == 0 {
warn!("Serving original file without resizing"); warn!("Serving original file without resizing");
return serve_file(&stored_path, &state, shout_id).await; serve_file(&stored_path, &state, shout_id).await
} else { } else {
let closest: u32 = find_closest_width(requested_width as u32); let closest: u32 = find_closest_width(requested_width as u32);
warn!("Calculated closest width: {} for requested: {}", closest, requested_width); warn!("Calculated closest width: {} for requested: {}", closest, requested_width);
@ -76,7 +76,7 @@ pub async fn proxy_handler(
match check_file_exists(&state.storj_client, &state.bucket, thumb_filename).await { match check_file_exists(&state.storj_client, &state.bucket, thumb_filename).await {
Ok(true) => { Ok(true) => {
warn!("serve existed thumb file: {}", thumb_filename); warn!("serve existed thumb file: {}", thumb_filename);
return serve_file(thumb_filename, &state, shout_id).await; serve_file(thumb_filename, &state, shout_id).await
}, },
Ok(false) => { Ok(false) => {
// Миниатюра не существует, возвращаем оригинал и запускаем генерацию миниатюры // Миниатюра не существует, возвращаем оригинал и запускаем генерацию миниатюры
@ -97,16 +97,18 @@ pub async fn proxy_handler(
} }
}); });
return Ok(original_file); Ok(original_file)
} }
Err(e) => { Err(e) => {
error!("ошибка при проверке существования миниатюры: {}", e); error!("ошибка при проверке существования миниатюры: {}", e);
return Err(ErrorInternalServerError("failed to load thumbnail")); Err(ErrorInternalServerError("failed to load thumbnail"))
} }
} }
} }
} else {
warn!("File is not an image, proceeding with normal serving");
serve_file(&stored_path, &state, shout_id).await
} }
warn!("File is not an image, proceeding with normal serving");
} else { } else {
warn!("Attempting to load from AWS - bucket: {}, path: {}", state.bucket, stored_path); warn!("Attempting to load from AWS - bucket: {}, path: {}", state.bucket, stored_path);