Skip to content

Commit 9f7f89e

Browse files
committed
monitor: Clean up logging when a package is dirty
This avoids printing the same message repeatedly. Signed-off-by: Ryan Gonzalez <[email protected]>
1 parent 54e19da commit 9f7f89e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/monitor.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ impl ObsMonitor {
200200

201201
let mut previous_code = None;
202202
let mut old_status_retries = 0;
203+
let mut was_dirty = false;
203204

204205
loop {
205206
let state = self.get_latest_state().await?;
@@ -218,7 +219,11 @@ impl ObsMonitor {
218219
tokio::time::sleep(options.sleep_on_building).await;
219220
}
220221
PackageBuildState::Dirty => {
221-
outputln!("Package is dirty, trying again later...");
222+
if !was_dirty {
223+
outputln!("Package is dirty, trying again later...");
224+
}
225+
226+
was_dirty = true;
222227
tokio::time::sleep(options.sleep_on_dirty).await;
223228
}
224229
PackageBuildState::PendingStatusPosted => {
@@ -244,6 +249,9 @@ impl ObsMonitor {
244249
if !matches!(state, PackageBuildState::PendingStatusPosted) {
245250
old_status_retries = 0;
246251
}
252+
if !matches!(state, PackageBuildState::Dirty) {
253+
was_dirty = false;
254+
}
247255
}
248256
}
249257

0 commit comments

Comments
 (0)