Skip to content

Commit

Permalink
fix: mark monitor as successful even if there are no new results (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Feb 26, 2023
1 parent 26e9c56 commit 366b1f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/src/monitoring/monitoring-center.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bool MonitoringCenter::checkMonitor(Monitor &monitor, const SearchQuery &search,
int newImages = 0;
QList<QSharedPointer<Image>> newImagesList;
QString state = "";
bool success = true;

for (Site *site : monitor.sites()) {
// Create a pack loader
Expand Down Expand Up @@ -92,6 +93,7 @@ bool MonitoringCenter::checkMonitor(Monitor &monitor, const SearchQuery &search,

const QString newState = countRun == 0 ? "empty" : (newImagesRun == 0 ? "finished" : "ok");
state = state.isEmpty() || state == newState ? newState : "mixed";
success = success && countRun != 0;
}

emit statusChanged(monitor, MonitoringStatus::Performing);
Expand Down Expand Up @@ -134,7 +136,7 @@ bool MonitoringCenter::checkMonitor(Monitor &monitor, const SearchQuery &search,

// Update monitor
monitor.setLastCheck(limit);
if (state == "ok") {
if (success) {
monitor.setLastSuccess(limit);
}
monitor.setLastState(state);
Expand Down

0 comments on commit 366b1f5

Please sign in to comment.