Skip to content

Commit 1f3fb3e

Browse files
committed
fix(update): add timeouts to npm registry client
Refs #291
1 parent 9975a6a commit 1f3fb3e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/registry_client.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use {
33
log::{debug, error},
44
reqwest::{header::ACCEPT, Client, StatusCode},
55
serde::{Deserialize, Serialize},
6-
std::collections::BTreeMap,
6+
std::{collections::BTreeMap, time::Duration},
77
thiserror::Error,
88
};
99

@@ -69,6 +69,12 @@ impl RegistryClient for LiveRegistryClient {
6969

7070
impl LiveRegistryClient {
7171
pub fn new() -> Self {
72-
LiveRegistryClient { client: Client::new() }
72+
LiveRegistryClient {
73+
client: Client::builder()
74+
.connect_timeout(Duration::from_secs(5))
75+
.timeout(Duration::from_secs(30))
76+
.build()
77+
.expect("Failed to build reqwest client"),
78+
}
7379
}
7480
}

0 commit comments

Comments
 (0)