From: Lennart Poettering Date: Thu, 29 Nov 2018 15:33:19 +0000 (+0100) Subject: core: before sending out a job new/change/removal message, send out unit change messa... X-Git-Tag: v240~127^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=17407bc28d731cd3efbfc1bf56cd963585e82fe9;p=thirdparty%2Fsystemd.git core: before sending out a job new/change/removal message, send out unit change message for job's unit We always want the state of the unit to be reflected first to the client before we claim the job has changed state, after all the job is the request to change unit state, and thus job changes are kinda the confirmation that the state changed as requested. --- diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c index 20d890b36c3..acb9f55a5ec 100644 --- a/src/core/dbus-job.c +++ b/src/core/dbus-job.c @@ -4,6 +4,7 @@ #include "alloc-util.h" #include "dbus-job.h" +#include "dbus-unit.h" #include "dbus.h" #include "job.h" #include "log.h" @@ -173,6 +174,9 @@ void bus_job_send_change_signal(Job *j) { assert(j); + /* Make sure that any change signal on the unit is reflected before we send out the change signal on the job */ + bus_unit_send_pending_change_signal(j->unit, true); + if (j->in_dbus_queue) { LIST_REMOVE(dbus_queue, j->manager->dbus_job_queue, j); j->in_dbus_queue = false; @@ -222,6 +226,9 @@ void bus_job_send_removed_signal(Job *j) { if (!j->sent_dbus_new_signal) bus_job_send_change_signal(j); + /* Make sure that any change signal on the unit is reflected before we send out the change signal on the job */ + bus_unit_send_pending_change_signal(j->unit, true); + r = bus_foreach_bus(j->manager, j->bus_track, send_removed_signal, j); if (r < 0) log_debug_errno(r, "Failed to send job remove signal for %u: %m", j->id);