lmpt will retry resolving artifacts
Some checks failed
continuous-integration/drone/push Build is failing
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:
parent
5ead609763
commit
814f01f389
|
@ -225,18 +225,34 @@ async fn process_file(
|
|||
p_id, f_id
|
||||
);
|
||||
|
||||
let url = Url::parse(
|
||||
http.get(url)
|
||||
.send()
|
||||
.await
|
||||
.into_diagnostic()?
|
||||
.text()
|
||||
.await
|
||||
.into_diagnostic()?
|
||||
.trim(),
|
||||
)
|
||||
.into_diagnostic()
|
||||
.wrap_err("failed to parse curseforge URL")?;
|
||||
let mut failed = false;
|
||||
let url = loop {
|
||||
let maybe_url = Url::parse(
|
||||
http.get(&url)
|
||||
.send()
|
||||
.await
|
||||
.into_diagnostic()?
|
||||
.text()
|
||||
.await
|
||||
.into_diagnostic()?
|
||||
.trim(),
|
||||
);
|
||||
|
||||
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!(
|
||||
"{} {}",
|
||||
|
|
Loading…
Reference in a new issue