From: Lennart Poettering Date: Wed, 29 Nov 2023 10:07:08 +0000 (+0100) Subject: logind: don't make idle action timer accuracy more coarse than timeout X-Git-Tag: v256-rc1~1300 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e20bfa5005ab5458837bb62cb35bc1687f25124f;p=thirdparty%2Fsystemd.git logind: don't make idle action timer accuracy more coarse than timeout If we allow the timer accuracy to grow larger then the timeout itself things are very confusing, because people might set a 1s time-out and we turn that into 30s. Hence, let's just cut off the 30s accuracy to the time-out itself, so that we stay close to what users configured. --- diff --git a/src/login/logind.c b/src/login/logind.c index 4123e6bb192..030f65da088 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -1036,7 +1036,7 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us m->event, &m->idle_action_event_source, CLOCK_MONOTONIC, - elapse, USEC_PER_SEC*30, + elapse, MIN(USEC_PER_SEC*30, m->idle_action_usec), /* accuracy of 30s, but don't have an accuracy lower than the idle action timeout */ manager_dispatch_idle_action, m); if (r < 0) return log_error_errno(r, "Failed to add idle event source: %m");