X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fjob.c;h=feeb563177e39351d1e05f512cde70403151797c;hb=ac45f971a12280de55b834a65237f72dcacfc099;hp=1bcf4968e2c5df0d31e59b0f771efd0382cfb2bc;hpb=28c758de94bc8ba97b89d9dab3f517cf466978d0;p=elogind.git diff --git a/src/core/job.c b/src/core/job.c index 1bcf4968e..feeb56317 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -864,11 +864,14 @@ static int job_dispatch_timer(sd_event_source *s, uint64_t monotonic, void *user int job_start_timer(Job *j) { int r; - if (j->unit->job_timeout <= 0 || j->timer_event_source) + if (j->timer_event_source) return 0; j->begin_usec = now(CLOCK_MONOTONIC); + if (j->unit->job_timeout <= 0) + return 0; + r = sd_event_add_monotonic(j->manager->event, j->begin_usec + j->unit->job_timeout, 0, job_dispatch_timer, j, &j->timer_event_source); if (r < 0) return r; @@ -1048,7 +1051,7 @@ int job_coldplug(Job *j) { assert(j); - if (j->begin_usec <= 0) + if (j->begin_usec == 0 || j->unit->job_timeout == 0) return 0; if (j->timer_event_source) @@ -1115,9 +1118,6 @@ int job_get_timeout(Job *j, uint64_t *timeout) { *timeout = MIN(x, y); - log_info("job_get_timeout %s %d/%"PRIu64" %d/%"PRIu64" -> 1/%"PRIu64, - j->unit->id, r, x, q, y, *timeout); - return 1; }