From 51684d8044ceb0c6f99e63ad8adef6c5582d7b03 Mon Sep 17 00:00:00 2001 From: Ryan Gonzalez Date: Thu, 1 Jun 2023 15:07:49 -0500 Subject: [PATCH] Remove dirty status waiting during montoring There isn't a ton of reason to do this here: - Uploads now already wait for the dirty status to disappear as part of filtering out disabled architectures. - If the dirty status flips during a build, there's no reason to wait on it again: the build is already running! - The presumed reason for the existence of these checks in our original ci-package-builder was to help eliminate the race between sources being uploaded and new builds appearing, which we already handle in a completely different way. Signed-off-by: Ryan Gonzalez --- src/handler.rs | 1 - src/monitor.rs | 24 ++---------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/handler.rs b/src/handler.rs index 8e68847..1ba2126 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -938,7 +938,6 @@ mod tests { log_tail: TEST_LOG_TAIL, monitor: PackageMonitoringOptions { sleep_on_building: Duration::ZERO, - sleep_on_dirty: Duration::ZERO, sleep_on_old_status: OLD_STATUS_SLEEP_DURATION, // High limit, since we don't really test that // functionality in the handler tests. diff --git a/src/monitor.rs b/src/monitor.rs index 4aab4ce..2880504 100644 --- a/src/monitor.rs +++ b/src/monitor.rs @@ -24,7 +24,6 @@ pub enum PackageCompletion { #[derive(Debug)] enum PackageBuildState { PendingStatusPosted, - Dirty, Building(obs::PackageCode), Completed(PackageCompletion), } @@ -49,7 +48,6 @@ pub struct MonitoredPackage { #[derive(Clone, Debug)] pub struct PackageMonitoringOptions { pub sleep_on_building: Duration, - pub sleep_on_dirty: Duration, pub sleep_on_old_status: Duration, pub max_old_status_retries: usize, } @@ -58,7 +56,6 @@ impl Default for PackageMonitoringOptions { fn default() -> Self { PackageMonitoringOptions { sleep_on_building: Duration::from_secs(10), - sleep_on_dirty: Duration::from_secs(30), sleep_on_old_status: Duration::from_secs(15), max_old_status_retries: 40, // 15 seconds * 40 tries = 10 minutes } @@ -118,9 +115,6 @@ impl ObsMonitor { self.package.arch ) })?; - if result.dirty { - return Ok(PackageBuildState::Dirty); - } let status = match result.get_status(&self.package.package) { Some(status) => status, @@ -129,9 +123,7 @@ impl ObsMonitor { None => return Ok(PackageBuildState::PendingStatusPosted), }; - if status.dirty { - Ok(PackageBuildState::Dirty) - } else if status.code.is_final() { + if status.code.is_final() { // Similarly to above, there is a small gap after a commit where the // previous build status is still posted. To ensure the build that's // now final is actually our own, check the build history to make @@ -206,7 +198,6 @@ impl ObsMonitor { let mut previous_code = None; let mut old_status_retries = 0; - let mut was_dirty = false; loop { let state = self.get_latest_state().await?; @@ -224,14 +215,6 @@ impl ObsMonitor { tokio::time::sleep(options.sleep_on_building).await; } - PackageBuildState::Dirty => { - if !was_dirty { - outputln!("Package is dirty, trying again later..."); - } - - was_dirty = true; - tokio::time::sleep(options.sleep_on_dirty).await; - } PackageBuildState::PendingStatusPosted => { ensure!( old_status_retries < options.max_old_status_retries, @@ -255,9 +238,6 @@ impl ObsMonitor { if !matches!(state, PackageBuildState::PendingStatusPosted) { old_status_retries = 0; } - if !matches!(state, PackageBuildState::Dirty) { - was_dirty = false; - } } } @@ -545,7 +525,7 @@ mod tests { ); let state = assert_ok!(monitor.get_latest_state().await); - assert_matches!(state, PackageBuildState::Dirty); + assert_matches!(state, PackageBuildState::Building(PackageCode::Unknown)); mock.set_package_build_status( TEST_PROJECT,