Skip to content

Commit 49cca0e

Browse files
Merge pull request #1659 from Kobzol/master-commit-timeout
Add timeout to master commit list download
2 parents 273e131 + 8e6ac57 commit 49cca0e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

collector/src/lib.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::compile::benchmark::{Benchmark, BenchmarkName};
1515
use crate::runtime::{BenchmarkGroup, BenchmarkSuite};
1616
use database::{ArtifactId, ArtifactIdNumber, Connection};
1717
use process::Stdio;
18+
use std::time::Duration;
1819

1920
#[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Deserialize)]
2021
pub struct DeltaTime(#[serde(with = "round_float")] pub f64);
@@ -267,7 +268,13 @@ pub struct MasterCommit {
267268
/// to validate hashes or expand them generally speaking. This may also change
268269
/// in the future.
269270
pub async fn master_commits() -> anyhow::Result<Vec<MasterCommit>> {
270-
let response = reqwest::get("https://triage.rust-lang.org/bors-commit-list").await?;
271+
let response = reqwest::ClientBuilder::new()
272+
.connect_timeout(Duration::from_secs(60))
273+
.timeout(Duration::from_secs(60))
274+
.build()?
275+
.get("https://triage.rust-lang.org/bors-commit-list")
276+
.send()
277+
.await?;
271278
Ok(response.json().await?)
272279
}
273280

0 commit comments

Comments
 (0)