From 94eeea4842b92736fbd36f20ee0b1b3c6fc01b9c Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Tue, 17 Nov 2026 12:46:16 +0100 Subject: [PATCH] launchpad,put: run the pre-flight Launchpad checks concurrently Each Launchpad API round trip costs a few hundred milliseconds of server processing, and put walked four of them sequentially (person, archive, published sources) before the connection came up: the slowest phase of the flow. The person and archive lookups are independent and now go out together; the three pre-flights (PPA info, target series, published versions) run as one join with results checked in the original order, so a missing PPA still reports the PPA error rather than the superseded check's. --- src/launchpad.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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