summaryrefslogtreecommitdiff
path: root/src/core/dbus-job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-11-29 16:33:19 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-01 12:53:26 +0100
commit17407bc28d731cd3efbfc1bf56cd963585e82fe9 (patch)
tree9a926835fe6d0229ad73ce9d31452c0799a6388c /src/core/dbus-job.c
parent6fcbec6f9b15e534badd069610e35f4c5303c502 (diff)
downloadsystemd-17407bc28d731cd3efbfc1bf56cd963585e82fe9.tar.gz
systemd-17407bc28d731cd3efbfc1bf56cd963585e82fe9.tar.bz2
systemd-17407bc28d731cd3efbfc1bf56cd963585e82fe9.zip
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.
Diffstat (limited to 'src/core/dbus-job.c')
-rw-r--r--src/core/dbus-job.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/dbus-job.c b/src/core/dbus-job.c
index 20d890b36c..acb9f55a5e 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);