]> git.ipfire.org Git - telemetry.git/commitdiff
source: Reset the results counter on disable
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 12 Jul 2026 11:13:37 +0000 (11:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 12 Jul 2026 11:13:37 +0000 (11:13 +0000)
That way, we don't carry over any errors if the source get re-enabled.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/source.c

index b1e3989a09321dd0b3f0caa2f1be6d29a51f162d..ffa8f0407a2e26b4362960591392e1a2a33a18d4 100644 (file)
@@ -122,6 +122,10 @@ struct td_source {
        } results;
 };
 
+static void td_source_reset_results(td_source* self) {
+       self->results.num = 0;
+}
+
 static int td_source_change_state(td_source* self, enum td_source_state state) {
        // If the state has not changed, we are doing nothing
        if (self->state == state)
@@ -146,6 +150,10 @@ static int td_source_change_state(td_source* self, enum td_source_state state) {
 
                case STATE_DISABLED:
                        DEBUG(self->ctx, "%s has been disabled\n", td_source_name(self));
+
+                       // Reset the results
+                       td_source_reset_results(self);
+
                        break;
        }