diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-28 18:25:39 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-01-28 19:07:13 -0500 |
commit | 8bb310c3c6f5a52f2d483fd8dfb16ca66ecf7a5f (patch) | |
tree | 1ac5ddf657b46a7a7beb2cacc2b2a9bf9150f80d /src/core/job.c | |
parent | 0f010ef2130e887347212d4a3f81abafc78985a0 (diff) |
manager: print ephemeral information about running jobs' timeouts (v2)
This reverts commit 28c758de94bc8ba97b89d9dab3f517cf466978d0
but makes job_coldplug smarter.
In (v1) I changed the job start timestamp to be always set, so the
start time can be reported in the cylon eye message. The bug was that
when deserializing jobs, they would be ignored if their start
timestamp was unset which was synonymous with no timeout. But after
the change, jobs would have a start timestamp set despite having no
timeout. After deserialization they would be considered immediately
expired. Fix this by checking if the timeout is not zero when
considering jobs for expiration.
Diffstat (limited to 'src/core/job.c')
-rw-r--r-- | src/core/job.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/job.c b/src/core/job.c index 1bcf4968e2..941f956025 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) |