If no real jobs were added to the transaction, do not activate it.
The JOB_NOP anchor does not perform any useful work and activating
such transaction only wastes resources.
Fixes #9751
tr->anchor_job,
mode == JOB_IGNORE_DEPENDENCIES ? TRANSACTION_IGNORE_ORDER : 0);
+ /* Only activate the transaction if it contains jobs other than NOP anchor.
+ * Short-circuiting here avoids unnecessary processing, such as emitting D-Bus signals. */
+ if (hashmap_size(tr->jobs) <= 1)
+ return 0;
+
r = transaction_activate(tr, m, mode, NULL, e);
if (r < 0)
return r;