Skip to content

Commit d3cd612

Browse files
committed
Inline the master_commits call
1 parent e2ab473 commit d3cd612

File tree

10 files changed

+323
-495
lines changed

10 files changed

+323
-495
lines changed

Cargo.lock

Lines changed: 289 additions & 485 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

collector/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ serde = { version = "1", features = ["derive"] }
1414
serde_json = "1"
1515
tempfile = "3"
1616
libc = "0.2"
17-
chrono = "0.4"
17+
chrono = { version = "0.4", features = ["serde"] }
1818
lazy_static = "1"
1919
semver = "1.0"
2020
reqwest = { version = "0.11", features = ["json"] }
2121
xz2 = "0.1.3"
2222
tar = "0.4"
2323
tokio = { version = "1.6", features = ["rt"] }
24-
rustc-artifacts = { path = "../../rustc-artifacts"}
2524
database = { path = "../database" }
2625
intern = { path = "../intern" }
2726
futures = "0.3.5"

collector/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,29 @@ pub fn command_output(cmd: &mut Command) -> anyhow::Result<process::Output> {
224224

225225
Ok(output)
226226
}
227+
228+
#[derive(Debug, Clone, Deserialize)]
229+
pub struct MasterCommit {
230+
pub sha: String,
231+
pub parent_sha: String,
232+
/// This is the pull request which this commit merged in.
233+
#[serde(default)]
234+
pub pr: Option<u32>,
235+
pub time: chrono::DateTime<chrono::Utc>,
236+
}
237+
238+
/// This provides the master-branch Rust commits which should have accompanying
239+
/// bors artifacts available.
240+
///
241+
/// The first commit returned (at index 0) is the most recent, the last is the
242+
/// oldest.
243+
///
244+
/// Specifically, this is the last 168 days of bors commits.
245+
///
246+
/// Note that this does not contain try commits today, so it should not be used
247+
/// to validate hashes or expand them generally speaking. This may also change
248+
/// in the future.
249+
pub async fn master_commits() -> Result<Vec<MasterCommit>, Box<dyn std::error::Error + Sync + Send>> {
250+
let response = reqwest::get("https://triage.rust-lang.org/bors-commit-list").await?;
251+
Ok(response.json().await?)
252+
}

collector/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ fn main_result() -> anyhow::Result<i32> {
811811
pub fn get_commit_or_fake_it(sha: &str) -> anyhow::Result<Commit> {
812812
let rt = tokio::runtime::Runtime::new().unwrap();
813813
Ok(rt
814-
.block_on(rustc_artifacts::master_commits())
814+
.block_on(collector::master_commits())
815815
.map_err(|e| anyhow::anyhow!("{:?}", e))
816816
.context("getting master commit list")?
817817
.into_iter()

site/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ toml = "0.5"
2929
rust_team_data = { git = "https://github.com/rust-lang/team" }
3030
parking_lot = "0.11"
3131
snap = "1"
32-
rustc-artifacts = { path = "../../rustc-artifacts"}
3332
itertools = "0.10"
3433
hashbrown = { version = "0.11", features = ["serde"] }
3534
arc-swap = "1.3"

site/src/load.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl InputData {
147147
pub async fn missing_commits(&self) -> Vec<(Commit, MissingReason)> {
148148
let conn = self.conn().await;
149149
let (master_commits, queued_commits, in_progress_artifacts) = futures::join!(
150-
rustc_artifacts::master_commits(),
150+
collector::master_commits(),
151151
conn.queued_commits(),
152152
conn.in_progress_artifacts()
153153
);

site/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async fn main() {
6767
futures::pin_mut!(fut);
6868
loop {
6969
futures::select! {
70-
s = server => {
70+
_s = server => {
7171
eprintln!("Server completed unexpectedly.");
7272
return;
7373
}

site/src/self_profile/crox.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn generate(pieces: super::Pieces, opt: Opt) -> anyhow::Result<Vec<u8>> {
130130

131131
let mut seq = serializer.serialize_seq(None)?;
132132

133-
let data = ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events)
133+
let data = ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events, None)
134134
.map_err(|e| anyhow::format_err!("{:?}", e))?;
135135

136136
let thread_to_collapsed_thread =

site/src/self_profile/flamegraph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct Opt {}
77

88
pub fn generate(title: &str, pieces: super::Pieces, _: Opt) -> anyhow::Result<Vec<u8>> {
99
let profiling_data =
10-
ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events)
10+
ProfilingData::from_buffers(pieces.string_data, pieces.string_index, pieces.events, None)
1111
.map_err(|e| anyhow::format_err!("{:?}", e))?;
1212

1313
let recorded_stacks = collapse_stacks(&profiling_data)

site/src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ pub async fn handle_compare(body: days::Request, data: &InputData) -> ServerResu
652652

653653
let (responses, commits) = futures::join!(
654654
data.query::<Option<f64>>(query, cids),
655-
rustc_artifacts::master_commits(),
655+
collector::master_commits(),
656656
);
657657
let commits = commits.map_err(|e| e.to_string())?;
658658
let mut responses = responses?;
@@ -749,7 +749,7 @@ impl DateData {
749749
None
750750
},
751751
pr: if let ArtifactId::Commit(c) = &commit {
752-
let master_commits = rustc_artifacts::master_commits().await.unwrap_or_default();
752+
let master_commits = collector::master_commits().await.unwrap_or_default();
753753
if let Some(m) = master_commits.iter().find(|m| m.sha == c.sha) {
754754
m.pr
755755
} else {

0 commit comments

Comments
 (0)