]> git.ipfire.org Git - pakfire.git/commitdiff
daemon: Keep the stats timer running continuously
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Sep 2024 03:40:34 +0000 (03:40 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Sep 2024 03:40:34 +0000 (03:40 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/daemon.c

index 8d216555698a78eab9c47e77e786fe580d63a095..0a51f9619d56c78511562fd3f98996a67423358d 100644 (file)
@@ -247,13 +247,6 @@ static int pakfire_daemon_submit_stats(sd_event_source* s, uint64_t usec, void*
                return r;
        }
 
-       // Activate the timer
-       r = sd_event_source_set_enabled(daemon->stat_timer, SD_EVENT_ONESHOT);
-       if (r < 0) {
-               CTX_ERROR(daemon->ctx, "Could not activate the stat timer: %s\n", strerror(-r));
-               return r;
-       }
-
        // Don't do anything if we don't have a control connection
        if (!daemon->control) {
                CTX_DEBUG(daemon->ctx, "Won't send stats without a control connection\n");
@@ -319,6 +312,13 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {
                return r;
        }
 
+       // Submit stats continuously
+       r = sd_event_source_set_enabled(daemon->stat_timer, SD_EVENT_ON);
+       if (r < 0) {
+               CTX_ERROR(daemon->ctx, "Could not activate the stat timer: %s\n", strerror(-r));
+               return r;
+       }
+
        return 0;
 }