Skip to content

Commit

Permalink
Add timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassot committed Jul 12, 2023
1 parent e50f38b commit 9ba0f26
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion quickwit/quickwit-indexing/src/source/http_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ pub(crate) const BATCH_NUM_BYTES_LIMIT: u64 = 5_000_000u64;
async fn read_lines(
uri: &str,
) -> anyhow::Result<Lines<BufReader<Box<dyn AsyncRead + Send + Unpin>>>> {
let stream = reqwest::Client::new()
let client = reqwest::ClientBuilder::new()
.connect_timeout(Duration::from_secs(10))
.timeout(Duration::from_secs(15))
.build()
.context("Failed to build reqwest client.")?;
let stream = client
.get(uri)
.send()
.await
Expand Down Expand Up @@ -349,6 +354,16 @@ mod tests {
assert_eq!(parse_node_idx("kafka_node_020"), 20);
}

#[test]
fn test_gh_archive_uri_expand() {
let uri = "https://data.gharchive.org/{2015..2024}-{01..13}-{01..32}-{0..24}.json.gz";
let uris = expand_uris(uri);
for uri in uris {
println!("{}", uri);
}
panic!("test")
}

#[test]
fn test_uri_expand() {
let uri = "http://localhost:3000/{00..2}-{0..3}.json";
Expand Down

0 comments on commit 9ba0f26

Please sign in to comment.