Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/automatically_retry_webrtc_build_downloads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
webrtc-sys: patch
webrtc-sys-build: patch
livekit: patch
livekit-ffi: patch
libwebrtc: patch
---

# Automatically retry webrtc build downloads
18 changes: 16 additions & 2 deletions webrtc-sys/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,22 @@ pub fn download_webrtc() -> Result<()> {
return Ok(());
}

let mut resp = reqwest::blocking::get(download_url())
.context("Failed to send HTTP request to download WebRTC")?;
let mut resp = reqwest::blocking::get(download_url());
for attempt in 1..3 {
let transient = match &resp {
Ok(resp) => {
resp.status().is_server_error() || resp.status() == StatusCode::TOO_MANY_REQUESTS
}
Err(_) => true,
};
if !transient {
break;
}
println!("cargo:warning=webrtc download attempt {} failed, retrying in 5s...", attempt);
std::thread::sleep(std::time::Duration::from_secs(5));
resp = reqwest::blocking::get(download_url());
}
let mut resp = resp.context("Failed to send HTTP request to download WebRTC")?;
if resp.status() != StatusCode::OK {
return Err(anyhow!("failed to download webrtc: {}", resp.status()));
}
Expand Down
Loading