Skip to content

Commit

Permalink
monitor: Clean up logging when a package is dirty
Browse files Browse the repository at this point in the history
This avoids printing the same message repeatedly.

Signed-off-by: Ryan Gonzalez <[email protected]>
  • Loading branch information
refi64 committed Aug 12, 2022
1 parent 54e19da commit 9f7f89e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ 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?;
Expand All @@ -218,7 +219,11 @@ impl ObsMonitor {
tokio::time::sleep(options.sleep_on_building).await;
}
PackageBuildState::Dirty => {
outputln!("Package is dirty, trying again later...");
if !was_dirty {
outputln!("Package is dirty, trying again later...");
}

was_dirty = true;
tokio::time::sleep(options.sleep_on_dirty).await;
}
PackageBuildState::PendingStatusPosted => {
Expand All @@ -244,6 +249,9 @@ impl ObsMonitor {
if !matches!(state, PackageBuildState::PendingStatusPosted) {
old_status_retries = 0;
}
if !matches!(state, PackageBuildState::Dirty) {
was_dirty = false;
}
}
}

Expand Down

0 comments on commit 9f7f89e

Please sign in to comment.