lmpt will retry resolving artifacts
Some checks failed
continuous-integration/drone/push Build is failing

curseforge's API is so good, this endpoints only works half of the
time...
This commit is contained in:
LordMZTE 2022-03-05 16:24:39 +01:00
parent 5ead609763
commit 814f01f389
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6

View file

@ -225,18 +225,34 @@ async fn process_file(
p_id, f_id p_id, f_id
); );
let url = Url::parse( let mut failed = false;
http.get(url) let url = loop {
.send() let maybe_url = Url::parse(
.await http.get(&url)
.into_diagnostic()? .send()
.text() .await
.await .into_diagnostic()?
.into_diagnostic()? .text()
.trim(), .await
) .into_diagnostic()?
.into_diagnostic() .trim(),
.wrap_err("failed to parse curseforge URL")?; );
if let (false, Err(_)) = (failed, &maybe_url) {
pb.println(
"Failed to resolve artifact, as curseforge is too incompetent to \
host a stable API. Retrying..."
.red()
.to_string(),
);
failed = true;
continue;
}
break maybe_url
.into_diagnostic()
.wrap_err("Failed to parse curseforge URL even after 2 tries lol")?;
};
pb.println(format!( pb.println(format!(
"{} {}", "{} {}",