summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-02-29 16:29:42 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-01 11:42:35 +0100
commit1b4154a8919c2a28964a4fe42b8875ba25e6a355 (patch)
tree774060dfae182a9c259a8539e8c216679309aa2c
parentef15d3e1ab67549a65b41e853e4d3b3b08a350d9 (diff)
downloadsystemd-1b4154a8919c2a28964a4fe42b8875ba25e6a355.tar.gz
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.
-rw-r--r--src/core/manager.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index c1bb365850..8e7dde634c 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;
}