diff --git a/src/launchpad.rs b/src/launchpad.rs index 79f6f5a..ddaca9b 100644 --- a/src/launchpad.rs +++ b/src/launchpad.rs @@ -207,11 +207,15 @@ pub async fn ppa_info(ppa: &str) -> Result> { let (user, name) = split_ppa(ppa)?; let client = crate::distro_info::http_client(); - let response = client - .get(person_url(&user)) - .send() - .await - .map_err(|e| format!("cannot reach the Launchpad API: {e}"))?; + // Two independent GETs, sent together: each Launchpad round trip + // costs a few hundred milliseconds of server processing, and the + // person lookup is only there to tell a missing user from a missing + // PPA in the errors below + let (person, archive) = tokio::join!( + client.get(person_url(&user)).send(), + client.get(archive_url(&user, &name)).send(), + ); + let response = person.map_err(|e| format!("cannot reach the Launchpad API: {e}"))?; if response.status() == reqwest::StatusCode::NOT_FOUND { return Err(format!( "Launchpad user '~{user}' does not exist: check the PPA argument '{ppa}'" @@ -225,11 +229,7 @@ pub async fn ppa_info(ppa: &str) -> Result> { .into()); } - let response = client - .get(archive_url(&user, &name)) - .send() - .await - .map_err(|e| format!("cannot reach the Launchpad API: {e}"))?; + let response = archive.map_err(|e| format!("cannot reach the Launchpad API: {e}"))?; match response.status() { reqwest::StatusCode::OK => { let info: PpaInfo = response