unit: enqueue cgroup empty check event if the last ref on a unit is dropped
authorLennart Poettering <lennart@poettering.net>
Fri, 5 Oct 2018 21:04:51 +0000 (23:04 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 9 Nov 2018 16:08:59 +0000 (17:08 +0100)
src/core/dbus-unit.c

index 97bceb1..7ef9baf 100644 (file)
@@ -1781,7 +1781,13 @@ static int bus_unit_track_handler(sd_bus_track *t, void *userdata) {
 
         u->bus_track = sd_bus_track_unref(u->bus_track); /* make sure we aren't called again */
 
+        /* If the client that tracks us disappeared, then there's reason to believe that the cgroup is empty now too,
+         * let's see */
+        unit_add_to_cgroup_empty_queue(u);
+
+        /* Also add the unit to the GC queue, after all if the client left it might be time to GC this unit */
         unit_add_to_gc_queue(u);
+
         return 0;
 }