From: Zbigniew Jędrzejewski-Szmek Date: Sat, 29 Feb 2020 15:29:42 +0000 (+0100) Subject: pid1: make cylon timeout significantly bigger when not showing any messages X-Git-Tag: v245-rc2~15^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1b4154a8919c2a28964a4fe42b8875ba25e6a355;p=thirdparty%2Fsystemd.git pid1: make cylon timeout significantly bigger when not showing any messages When we are booting with show-status=on, normally new status updates happen a few times per second. Thus, it is reasonable to start showing the cylon eye after 5 s, because that means a significant delay has happened. When we are running with show-status=off or show-status=auto (and no error had occured), the user is expecting maybe 15 to 90 seconds with no output (because that's usually how long the whole boot takes). So we shouldn't bother the user with information about a few seconds of delay. Let's make the timeout 25s if we are not showing any messages. Conversly, when we are outputting status messages, we can show the cylon eye with a shorter delay, now that we removed the connection to enablement status. Let's make this 2s, so users get feedback about delays more quickly. --- diff --git a/src/core/manager.c b/src/core/manager.c index c1bb3658508..8e7dde634ce 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -85,7 +85,8 @@ #define CGROUPS_AGENT_RCVBUF_SIZE (8*1024*1024) /* Initial delay and the interval for printing status messages about running jobs */ -#define JOBS_IN_PROGRESS_WAIT_USEC (5*USEC_PER_SEC) +#define JOBS_IN_PROGRESS_WAIT_USEC (2*USEC_PER_SEC) +#define JOBS_IN_PROGRESS_QUIET_WAIT_USEC (25*USEC_PER_SEC) #define JOBS_IN_PROGRESS_PERIOD_USEC (USEC_PER_SEC / 3) #define JOBS_IN_PROGRESS_PERIOD_DIVISOR 3 @@ -109,6 +110,12 @@ static int manager_dispatch_timezone_change(sd_event_source *source, const struc static int manager_run_environment_generators(Manager *m); static int manager_run_generators(Manager *m); +static usec_t manager_watch_jobs_next_time(Manager *m) { + return usec_add(now(CLOCK_MONOTONIC), + show_status_on(m->show_status) ? JOBS_IN_PROGRESS_WAIT_USEC : + JOBS_IN_PROGRESS_QUIET_WAIT_USEC); +} + static void manager_watch_jobs_in_progress(Manager *m) { usec_t next; int r; @@ -124,7 +131,7 @@ static void manager_watch_jobs_in_progress(Manager *m) { if (m->jobs_in_progress_event_source) return; - next = now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC; + next = manager_watch_jobs_next_time(m); r = sd_event_add_time( m->event, &m->jobs_in_progress_event_source, @@ -3773,8 +3780,8 @@ void manager_check_finished(Manager *m) { if (hashmap_size(m->jobs) > 0) { if (m->jobs_in_progress_event_source) /* Ignore any failure, this is only for feedback */ - (void) sd_event_source_set_time(m->jobs_in_progress_event_source, now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC); - + (void) sd_event_source_set_time(m->jobs_in_progress_event_source, + manager_watch_jobs_next_time(m)); return; }