fix: Downloading fallback + better logging in production
This commit is contained in:
parent
269f0d9b78
commit
2d29f3a5c7
3 changed files with 6 additions and 1 deletions
|
|
@ -265,6 +265,7 @@ pub async fn download_libraries(
|
|||
artifact: Some(ref artifact), ..
|
||||
}) = lib.downloads {
|
||||
if !artifact.url.is_empty() {
|
||||
tracing::info!("fetching library '{}' from '{}'", &lib.name, &artifact.url);
|
||||
let bytes = fetch(&artifact.url, Some(&artifact.sha1), &st.fetch_semaphore).await?;
|
||||
write(&path, &bytes, &st.io_semaphore).await?;
|
||||
tracing::trace!("fetched library {} to path {:?}", &lib.name, &path);
|
||||
|
|
@ -272,6 +273,7 @@ pub async fn download_libraries(
|
|||
}
|
||||
}
|
||||
|
||||
tracing::info!("fetching #2 library '{}' from '{}'", &lib.name, &artifact.url);
|
||||
let url = [lib.url.as_deref().unwrap_or("https://libraries.minecraft.net/"), &artifact_path].concat();
|
||||
let bytes = fetch(&url, None, &st.fetch_semaphore).await?;
|
||||
write(&path, &bytes, &st.io_semaphore).await?;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub fn start_logger() -> Option<WorkerGuard> {
|
|||
});
|
||||
|
||||
let subscriber = tracing_subscriber::registry()
|
||||
.with(tracing_subscriber::fmt::layer())
|
||||
.with(tracing_subscriber::fmt::layer().pretty())
|
||||
.with(filter)
|
||||
.with(tracing_error::ErrorLayer::default());
|
||||
|
||||
|
|
@ -59,6 +59,7 @@ pub fn start_logger() -> Option<WorkerGuard> {
|
|||
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
|
||||
|
||||
let subscriber = tracing_subscriber::registry()
|
||||
.with(tracing_subscriber::fmt::layer().pretty())
|
||||
.with(
|
||||
tracing_subscriber::fmt::layer()
|
||||
.with_writer(non_blocking)
|
||||
|
|
|
|||
|
|
@ -106,6 +106,8 @@ pub async fn fetch_advanced(
|
|||
|
||||
match result {
|
||||
Ok(x) => {
|
||||
let x = x.error_for_status()?;
|
||||
|
||||
let bytes = if let Some((feed, total)) = &ingress {
|
||||
let length = x.content_length();
|
||||
if let Some(total_size) = length {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue