From 9fc677e3c997548e701f418e0b413441e1c5e891 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 13 Feb 2018 18:27:47 +0100 Subject: [PATCH] core: don't bother enqueuing signal messages into busses that aren't ready yet This is an optimization: there's no point in enqueuing unit and job change notificiation signal messages into bus connection that aren't fully set up yet. This doesn't fix #8166 but should lower the load of messages enqueued but not processed yet a bit. --- src/core/dbus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/dbus.c b/src/core/dbus.c index 305824da9b..d023c8715c 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -1197,6 +1197,11 @@ int bus_foreach_bus( /* Send to all direct buses, unconditionally */ SET_FOREACH(b, m->private_buses, i) { + + /* Don't bother with enqueing these messages to clients that haven't started yet */ + if (sd_bus_is_ready(b) <= 0) + continue; + r = send_message(b, userdata); if (r < 0) ret = r;