Skip to content

Commit 4186eea

Browse files
committed
don't limit the rustc version we rebuild up to
After the first rebuild is finished I think we can do "continious rebuilds" now.
1 parent 25e199d commit 4186eea

5 files changed

+37
-90
lines changed

.sqlx/query-91511cc8904f313fa308b164d79d840aed032502efbc26ce53ea89512a5d8163.json

-41
This file was deleted.

.sqlx/query-aee84ef8b568045ef4928498578911074a74b38084b93dbe62c23d9348b8e609.json

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/build_queue.rs

+2-45
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,6 @@ pub async fn queue_rebuilds(
693693
SELECT
694694
c.name,
695695
r.version,
696-
(
697-
SELECT MAX(b.rustc_nightly_date)
698-
FROM builds AS b
699-
WHERE b.rid = r.id AND b.rustc_nightly_date IS NOT NULL
700-
) AS rustc_nightly_date,
701696
(
702697
SELECT MAX(COALESCE(b.build_finished, b.build_started))
703698
FROM builds AS b
@@ -709,12 +704,8 @@ pub async fn queue_rebuilds(
709704
WHERE
710705
r.rustdoc_status = TRUE
711706
) as i
712-
WHERE i.rustc_nightly_date < $1
713707
ORDER BY i.last_build_attempt ASC
714-
LIMIT $2",
715-
config
716-
.rebuild_up_to_date
717-
.expect("config.rebuild_up_to_date not set"),
708+
LIMIT $1",
718709
rebuilds_to_queue,
719710
)
720711
.fetch(&mut *conn);
@@ -741,46 +732,14 @@ mod tests {
741732
use crate::test::FakeBuild;
742733

743734
use super::*;
744-
use chrono::{NaiveDate, Utc};
735+
use chrono::Utc;
745736
use std::time::Duration;
746737

747-
#[test]
748-
fn test_dont_rebuild_when_new() {
749-
crate::test::async_wrapper(|env| async move {
750-
env.override_config(|config| {
751-
config.max_queued_rebuilds = Some(100);
752-
config.rebuild_up_to_date = Some(NaiveDate::from_ymd_opt(2020, 1, 1).unwrap());
753-
});
754-
755-
env.fake_release()
756-
.await
757-
.name("foo")
758-
.version("0.1.0")
759-
.builds(vec![
760-
FakeBuild::default()
761-
.rustc_version("rustc 1.84.0-nightly (e7c0d2750 2020-10-15)"),
762-
])
763-
.create()
764-
.await?;
765-
766-
let build_queue = env.async_build_queue().await;
767-
assert!(build_queue.queued_crates().await?.is_empty());
768-
769-
let mut conn = env.async_db().await.async_conn().await;
770-
queue_rebuilds(&mut conn, &env.config(), &build_queue).await?;
771-
772-
assert!(build_queue.queued_crates().await?.is_empty());
773-
774-
Ok(())
775-
})
776-
}
777-
778738
#[test]
779739
fn test_rebuild_when_old() {
780740
crate::test::async_wrapper(|env| async move {
781741
env.override_config(|config| {
782742
config.max_queued_rebuilds = Some(100);
783-
config.rebuild_up_to_date = Some(NaiveDate::from_ymd_opt(2024, 1, 1).unwrap());
784743
});
785744

786745
env.fake_release()
@@ -815,7 +774,6 @@ mod tests {
815774
crate::test::async_wrapper(|env| async move {
816775
env.override_config(|config| {
817776
config.max_queued_rebuilds = Some(1);
818-
config.rebuild_up_to_date = Some(NaiveDate::from_ymd_opt(2024, 1, 1).unwrap());
819777
});
820778

821779
let build_queue = env.async_build_queue().await;
@@ -858,7 +816,6 @@ mod tests {
858816
crate::test::async_wrapper(|env| async move {
859817
env.override_config(|config| {
860818
config.max_queued_rebuilds = Some(1);
861-
config.rebuild_up_to_date = Some(NaiveDate::from_ymd_opt(2024, 1, 1).unwrap());
862819
});
863820

864821
let build_queue = env.async_build_queue().await;

src/config.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{cdn::CdnKind, storage::StorageKind};
22
use anyhow::{Context, Result, anyhow, bail};
3-
use chrono::NaiveDate;
43
use std::{env::VarError, error::Error, path::PathBuf, str::FromStr, time::Duration};
54
use tracing::trace;
65
use url::Url;
@@ -120,7 +119,6 @@ pub struct Config {
120119

121120
// automatic rebuild configuration
122121
pub(crate) max_queued_rebuilds: Option<u16>,
123-
pub(crate) rebuild_up_to_date: Option<NaiveDate>,
124122
}
125123

126124
impl Config {
@@ -243,7 +241,6 @@ impl Config {
243241
86400,
244242
)?),
245243
max_queued_rebuilds: maybe_env("DOCSRS_MAX_QUEUED_REBUILDS")?,
246-
rebuild_up_to_date: maybe_env("DOCSRS_REBUILD_UP_TO_DATE")?,
247244
})
248245
}
249246
}

src/utils/daemon.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn start_background_queue_rebuild<C: Context>(context: &C) -> Result<(), Err
9696
let config = context.config()?;
9797
let build_queue = runtime.block_on(context.async_build_queue())?;
9898

99-
if config.max_queued_rebuilds.is_none() || config.rebuild_up_to_date.is_none() {
99+
if config.max_queued_rebuilds.is_none() {
100100
info!("rebuild config incomplete, skipping rebuild queueing");
101101
return Ok(());
102102
}

0 commit comments

Comments
 (0)