]> git.ipfire.org Git - pakfire.git/commitdiff
daemon: Send dummy stats using the event loop
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Sep 2024 03:37:33 +0000 (03:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 15 Sep 2024 03:37:33 +0000 (03:37 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/daemon.c

index c0b730cb201d169233f96cf4df847d2a445fda79..8d216555698a78eab9c47e77e786fe580d63a095 100644 (file)
@@ -236,13 +236,6 @@ static int pakfire_daemon_submit_stats(sd_event_source* s, uint64_t usec, void*
        struct pakfire_daemon* daemon = data;
        int r;
 
-#if 0 // XXX TEMPORARILY DISABLED
-       // Submit stats
-       r = pakfire_buildservice_submit_stats(daemon->service);
-       if (r < 0)
-               CTX_ERROR(daemon->ctx, "Could not submit stats: %s\n", strerror(-r));
-#endif
-
        // If we have any workers running, we will submit our stats
        // every five seconds, otherwise 30 seconds is enough.
        uint64_t next = (daemon->running_workers > 0) ? 5000000 : 30000000;
@@ -261,7 +254,20 @@ static int pakfire_daemon_submit_stats(sd_event_source* s, uint64_t usec, void*
                return 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");
+               return 0;
+       }
+
+       // XXX TODO
+
+       // Send the message
+       r = pakfire_xfer_send_message(daemon->control, "{}", 2);
+       if (r)
+               return r;
+
+       return 0;
 }
 
 static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) {