From: Lennart Poettering Date: Mon, 1 Nov 2010 16:50:43 +0000 (+0100) Subject: service: delay automatic restart if job is pending X-Git-Tag: v12~78 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2edfa36685588a5e224d1f86b3fcc16c46766fea;p=systemd service: delay automatic restart if job is pending --- diff --git a/TODO b/TODO index 8ae5fc5b..a97ba9f1 100644 --- a/TODO +++ b/TODO @@ -74,8 +74,6 @@ * we now order plymouth after udev-trigger. Can we optimize this? -* disable respawn when we are going down anyway. - * drop tmp.mount External: diff --git a/src/service.c b/src/service.c index d3c750e5..0b54e5bf 100644 --- a/src/service.c +++ b/src/service.c @@ -2039,6 +2039,13 @@ static void service_enter_restart(Service *s) { assert(s); dbus_error_init(&error); + if (s->meta.job) { + log_info("Job pending for unit, delaying automatic restart."); + + if ((r = unit_watch_timer(UNIT(s), s->restart_usec, &s->timer_watch)) < 0) + goto fail; + } + service_enter_dead(s, true, false); if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s), JOB_FAIL, false, &error, NULL)) < 0)