Skip to content

Commit

Permalink
Dirty fix version of artifact for re-implement 1.16.5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
DIDIRUS4 committed Jul 19, 2024
1 parent 9aacf73 commit 46852f3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/app-lib/src/util/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ where
#[allow(clippy::too_many_arguments)]
pub async fn fetch_advanced(
method: Method,
url: &str,
mut url: &str,
sha1: Option<&str>,
json_body: Option<serde_json::Value>,
header: Option<(&str, &str)>,
Expand All @@ -100,6 +100,7 @@ pub async fn fetch_advanced(
) -> crate::Result<Bytes> {
let io_semaphore = semaphore.0.read().await;
let _permit = io_semaphore.acquire().await?;
const FALLBACK_METADATA_URL: &str = "https://meta.modrinth.com";

for attempt in 1..=(FETCH_ATTEMPTS + 1) {
let mut req = REQWEST_CLIENT.request(method.clone(), url);
Expand Down Expand Up @@ -175,7 +176,10 @@ pub async fn fetch_advanced(
return Err(err.into());
}
}
Err(_) if attempt <= 3 => continue,
Err(_) if attempt <= 3 => {
url = FALLBACK_METADATA_URL;
continue;
}
Err(err) => {
return Err(err.into());
}
Expand Down

0 comments on commit 46852f3

Please sign in to comment.