chiark / gitweb /
job: always add waiting jobs to run queue during coldplug
authorMichael Marineau <michael.marineau@coreos.com>
Mon, 12 May 2014 07:26:16 +0000 (09:26 +0200)
committerMichal Sekletar <msekleta@redhat.com>
Mon, 12 May 2014 07:32:06 +0000 (09:32 +0200)
commit 20a83d7bf was not equivalent to the original bug fix proposed by
Michal Sekletar <msekleta@redhat.com>. The committed version only added
the job to the run queue if the job had a timeout, which most jobs do
not have. Just re-ordering the code gets us the intended functionality

src/core/job.c

index 835cfe173b1f093e85cb2eb19f3e9c91e5598291..dc4f44150c3c6fbc091092762ad36ef74ac07436 100644 (file)
@@ -1060,15 +1060,15 @@ int job_coldplug(Job *j) {
         if (r < 0)
                 return r;
 
+        if (j->state == JOB_WAITING)
+                job_add_to_run_queue(j);
+
         if (j->begin_usec == 0 || j->unit->job_timeout == 0)
                 return 0;
 
         if (j->timer_event_source)
                 j->timer_event_source = sd_event_source_unref(j->timer_event_source);
 
-        if (j->state == JOB_WAITING)
-                job_add_to_run_queue(j);
-
         r = sd_event_add_time(
                         j->manager->event,
                         &j->timer_event_source,