mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user