mirror of
https://github.com/systemd/systemd.git
synced 2026-07-18 21:40:14 +00:00
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.
This commit is contained in:
committed by
Yu Watanabe
parent
4855d82348
commit
e20bfa5005
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user