From 294b7461ff4ed30c036a3a81ddd6d8d6d7eb4af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Mon, 21 Sep 2026 15:15:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E4=BA=A7=E7=89=A9=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E9=87=8D=E8=AF=95=E9=87=8C=E7=9A=84=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E8=BE=BEpanic=E5=88=86=E6=94=AF=20-=20download=5Fartifact=20?= =?UTF-8?q?=E5=8E=9F=E5=85=88=E7=94=A8=20for=20+=20last=5Ferror=20+=20expe?= =?UTF-8?q?ct=20=E6=94=B6=E5=B0=BE=EF=BC=8C=E5=BE=AA=E7=8E=AF=E6=AF=8F?= =?UTF-8?q?=E8=BD=AE=E9=83=BD=E4=BC=9A=20return=EF=BC=8Cexpect=20=E5=AE=9E?= =?UTF-8?q?=E9=99=85=E4=B8=8D=E5=8F=AF=E8=BE=BE=EF=BC=8C=E5=8D=B4=E7=BB=99?= =?UTF-8?q?=E5=BA=93=E7=95=99=E4=B8=8B=E4=B8=80=E6=9D=A1=E6=BD=9C=E5=9C=A8?= =?UTF-8?q?=20panic=20=E8=B7=AF=E5=BE=84=20-=20=E6=94=B9=E4=B8=BA=20loop?= =?UTF-8?q?=20=E5=86=85=E9=80=92=E5=A2=9E=20attempt=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E8=80=97=E5=B0=BD=E6=97=B6=E7=9B=B4=E6=8E=A5=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=9C=80=E5=90=8E=E4=B8=80=E6=AC=A1=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E9=87=8D=E8=AF=95=E6=AC=A1=E6=95=B0=E4=B8=8E=E9=80=80?= =?UTF-8?q?=E9=81=BF=E8=A1=8C=E4=B8=BA=E4=B8=8D=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server-rs/crates/platform-tripo/src/common/client.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server-rs/crates/platform-tripo/src/common/client.rs b/server-rs/crates/platform-tripo/src/common/client.rs index b0b8e558d..5c31a5bcc 100644 --- a/server-rs/crates/platform-tripo/src/common/client.rs +++ b/server-rs/crates/platform-tripo/src/common/client.rs @@ -74,20 +74,18 @@ impl TripoProviderClient { url: &TripoUrl, ) -> Result { let total_attempts = self.artifact_retries.saturating_add(1); - let mut last_error = None; + let mut attempt = 1; - for attempt in 1..=total_attempts { + loop { match self.download_artifact_once(task_id, url).await { Ok(downloaded) => return Ok(downloaded), Err(error) if attempt < total_attempts && error.is_retryable() => { - last_error = Some(error); tokio::time::sleep(download_backoff(attempt)).await; + attempt += 1; } Err(error) => return Err(error), } } - - Err(last_error.expect("artifact download has at least one attempt")) } async fn download_artifact_once(