core: enqueue unit earlier when state changes

Previously, we'd enqueue a unit to the dbus queue whenever the state
changed, after we processed the state change fully. This commit to the
beginning of the state change. This has the benefit that when the state
change causes a job to complete the unit is already in the dbus queue,
and thus we get the guarantee that any unit change can be sent out to
clients before the job change.
This commit is contained in:
Lennart Poettering 2018-11-29 18:48:52 +01:00
parent e6d05912cb
commit 3c4832ada4
1 changed files with 4 additions and 1 deletions

View File

@ -2341,6 +2341,10 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, UnitNotifyFlag
m = u->manager;
/* Let's enqueue the change signal early. In case this unit has a job associated we want that this unit is in
* the bus queue, so that any job change signal queued will force out the unit change signal first. */
unit_add_to_dbus_queue(u);
/* Update timestamps for state changes */
if (!MANAGER_IS_RELOADING(m)) {
dual_timestamp_get(&u->state_change_timestamp);
@ -2499,7 +2503,6 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, UnitNotifyFlag
}
}
unit_add_to_dbus_queue(u);
unit_add_to_gc_queue(u);
}