Skip to content

Commit 51684d8

Browse files
refi64sjoerdsimons
authored andcommitted
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 <[email protected]>
1 parent 42ae801 commit 51684d8

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

src/handler.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,6 @@ mod tests {
938938
log_tail: TEST_LOG_TAIL,
939939
monitor: PackageMonitoringOptions {
940940
sleep_on_building: Duration::ZERO,
941-
sleep_on_dirty: Duration::ZERO,
942941
sleep_on_old_status: OLD_STATUS_SLEEP_DURATION,
943942
// High limit, since we don't really test that
944943
// functionality in the handler tests.

src/monitor.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub enum PackageCompletion {
2424
#[derive(Debug)]
2525
enum PackageBuildState {
2626
PendingStatusPosted,
27-
Dirty,
2827
Building(obs::PackageCode),
2928
Completed(PackageCompletion),
3029
}
@@ -49,7 +48,6 @@ pub struct MonitoredPackage {
4948
#[derive(Clone, Debug)]
5049
pub struct PackageMonitoringOptions {
5150
pub sleep_on_building: Duration,
52-
pub sleep_on_dirty: Duration,
5351
pub sleep_on_old_status: Duration,
5452
pub max_old_status_retries: usize,
5553
}
@@ -58,7 +56,6 @@ impl Default for PackageMonitoringOptions {
5856
fn default() -> Self {
5957
PackageMonitoringOptions {
6058
sleep_on_building: Duration::from_secs(10),
61-
sleep_on_dirty: Duration::from_secs(30),
6259
sleep_on_old_status: Duration::from_secs(15),
6360
max_old_status_retries: 40, // 15 seconds * 40 tries = 10 minutes
6461
}
@@ -118,9 +115,6 @@ impl ObsMonitor {
118115
self.package.arch
119116
)
120117
})?;
121-
if result.dirty {
122-
return Ok(PackageBuildState::Dirty);
123-
}
124118

125119
let status = match result.get_status(&self.package.package) {
126120
Some(status) => status,
@@ -129,9 +123,7 @@ impl ObsMonitor {
129123
None => return Ok(PackageBuildState::PendingStatusPosted),
130124
};
131125

132-
if status.dirty {
133-
Ok(PackageBuildState::Dirty)
134-
} else if status.code.is_final() {
126+
if status.code.is_final() {
135127
// Similarly to above, there is a small gap after a commit where the
136128
// previous build status is still posted. To ensure the build that's
137129
// now final is actually our own, check the build history to make
@@ -206,7 +198,6 @@ impl ObsMonitor {
206198

207199
let mut previous_code = None;
208200
let mut old_status_retries = 0;
209-
let mut was_dirty = false;
210201

211202
loop {
212203
let state = self.get_latest_state().await?;
@@ -224,14 +215,6 @@ impl ObsMonitor {
224215

225216
tokio::time::sleep(options.sleep_on_building).await;
226217
}
227-
PackageBuildState::Dirty => {
228-
if !was_dirty {
229-
outputln!("Package is dirty, trying again later...");
230-
}
231-
232-
was_dirty = true;
233-
tokio::time::sleep(options.sleep_on_dirty).await;
234-
}
235218
PackageBuildState::PendingStatusPosted => {
236219
ensure!(
237220
old_status_retries < options.max_old_status_retries,
@@ -255,9 +238,6 @@ impl ObsMonitor {
255238
if !matches!(state, PackageBuildState::PendingStatusPosted) {
256239
old_status_retries = 0;
257240
}
258-
if !matches!(state, PackageBuildState::Dirty) {
259-
was_dirty = false;
260-
}
261241
}
262242
}
263243

@@ -545,7 +525,7 @@ mod tests {
545525
);
546526

547527
let state = assert_ok!(monitor.get_latest_state().await);
548-
assert_matches!(state, PackageBuildState::Dirty);
528+
assert_matches!(state, PackageBuildState::Building(PackageCode::Unknown));
549529

550530
mock.set_package_build_status(
551531
TEST_PROJECT,

0 commit comments

Comments
 (0)