]> git.ipfire.org Git - telemetry.git/commitdiff
source: Disable all sources that fail all the time
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 Oct 2025 13:08:08 +0000 (13:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 19 Oct 2025 13:08:08 +0000 (13:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/source.c

index 38feb365b49f8f17dd235789d469e9129160b203..e077b3d79e4d579e4f8d817fdd99d8bf073ef80c 100644 (file)
@@ -207,8 +207,15 @@ static int collecty_source_error_detection(collecty_source* self, int result, ui
                        collecty_source_name(self), collecty_source_count_bad_results(self));
        }
 
+       // Count all bad results
+       int bad_results = collecty_source_count_bad_results(self);
+
+       // Disable the source if it has failed
+       if (bad_results >= NUM_RESULTS)
+               state = STATE_DISABLED;
+
        // If the last N attempts have been bad, we are in error state
-       if (collecty_source_count_bad_results(self) >= ERROR_THRESHOLD)
+       else if (bad_results >= ERROR_THRESHOLD)
                state = STATE_ERROR;
 
        // Check if we are flapping