Skip to content

Commit 2d29f3a

Browse files
committed
fix: Downloading fallback + better logging in production
1 parent 269f0d9 commit 2d29f3a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

packages/core/src/game/metadata.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ pub async fn download_libraries(
265265
artifact: Some(ref artifact), ..
266266
}) = lib.downloads {
267267
if !artifact.url.is_empty() {
268+
tracing::info!("fetching library '{}' from '{}'", &lib.name, &artifact.url);
268269
let bytes = fetch(&artifact.url, Some(&artifact.sha1), &st.fetch_semaphore).await?;
269270
write(&path, &bytes, &st.io_semaphore).await?;
270271
tracing::trace!("fetched library {} to path {:?}", &lib.name, &path);
271272
return Ok::<_, crate::Error>(());
272273
}
273274
}
274275

276+
tracing::info!("fetching #2 library '{}' from '{}'", &lib.name, &artifact.url);
275277
let url = [lib.url.as_deref().unwrap_or("https://libraries.minecraft.net/"), &artifact_path].concat();
276278
let bytes = fetch(&url, None, &st.fetch_semaphore).await?;
277279
write(&path, &bytes, &st.io_semaphore).await?;

packages/core/src/logger.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn start_logger() -> Option<WorkerGuard> {
2828
});
2929

3030
let subscriber = tracing_subscriber::registry()
31-
.with(tracing_subscriber::fmt::layer())
31+
.with(tracing_subscriber::fmt::layer().pretty())
3232
.with(filter)
3333
.with(tracing_error::ErrorLayer::default());
3434

@@ -59,6 +59,7 @@ pub fn start_logger() -> Option<WorkerGuard> {
5959
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
6060

6161
let subscriber = tracing_subscriber::registry()
62+
.with(tracing_subscriber::fmt::layer().pretty())
6263
.with(
6364
tracing_subscriber::fmt::layer()
6465
.with_writer(non_blocking)

packages/core/src/utils/http.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ pub async fn fetch_advanced(
106106

107107
match result {
108108
Ok(x) => {
109+
let x = x.error_for_status()?;
110+
109111
let bytes = if let Some((feed, total)) = &ingress {
110112
let length = x.content_length();
111113
if let Some(total_size) = length {

0 commit comments

Comments
 (0)