Skip to content

Commit 48ffc04

Browse files
add download timeouts for PDSC entries, log error to STDOUT
Add a timeout of 5 seconds on downloads of PDSC entries, and log an error to stdout. This way broken PSDC entries do not hang the `pyocd pack update` command Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
1 parent 2e6420b commit 48ffc04

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

rust/cmsis-pack/src/update/download.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ use std::collections::HashMap;
1919
const CONCURRENCY: usize = 32;
2020
const HOST_LIMIT: usize = 6;
2121
const MAX_RETRIES: usize = 3;
22+
const CONNECT_TIMEOUT: u64 = 15;
23+
const TIMEOUT: u64 = 60;
2224

2325
fn pdsc_url(pdsc: &mut PdscRef) -> String {
2426
if pdsc.url.ends_with('/') {
@@ -171,6 +173,8 @@ where
171173
pub fn new(config: &'a Conf, prog: Prog) -> Result<Self, Error> {
172174
let client = ClientBuilder::new()
173175
.redirect(redirect::Policy::limited(5))
176+
.connect_timeout(Duration::from_secs(CONNECT_TIMEOUT))
177+
.timeout(Duration::from_secs(TIMEOUT))
174178
.build()?;
175179

176180
Ok(DownloadContext {

0 commit comments

Comments
 (0)