From: Michael Tremer Date: Sun, 15 Sep 2024 03:37:33 +0000 (+0000) Subject: daemon: Send dummy stats using the event loop X-Git-Tag: 0.9.30~1193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a51756028ab86bc94f7c1c9320a6582a661dc1f;p=pakfire.git daemon: Send dummy stats using the event loop Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/daemon.c b/src/libpakfire/daemon.c index c0b730cb2..8d2165556 100644 --- a/src/libpakfire/daemon.c +++ b/src/libpakfire/daemon.c @@ -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) {