core: delay persistent timers by "RandomizedDelaySec=" at boot.
authorTaro Yamada <archer_ame@yahoo.co.jp>
Tue, 19 Feb 2019 12:01:50 +0000 (21:01 +0900)
committerTaro Yamada <archer_ame@yahoo.co.jp>
Thu, 21 Feb 2019 11:33:21 +0000 (20:33 +0900)
commita87c1d3a979f8c2641471bed93577558a1027a24
tree4ce63ddfc7a5682fb85aec5724e98de13a8ad6c1
parent8605a4b9eb1081a2f56745b57dc5d13a7637048e
core: delay persistent timers by "RandomizedDelaySec=" at boot.

Fixes #5659.
Currently, if Persistent=true and the machine is off at the scheduled time of the timer unit, the timer
will be triggered immediately at the next boot even if RandomizedDelaySec= is specified.

As a result, if multiple timers meet that condition, they will be triggered at the same time and too
much CPU/IO work makes boot slow down.

With this commit, if the scheduled time of the persistent timer has already elapsed at boot,
set the time when systemd first started as the scheduled time and RandomizedDelaySec= is applied to it.
src/core/timer.c