timer: add new feature FixedRandomDelay=

FixedRandomDelay=yes will use
`siphash24(sd_id128_get_machine() || MANAGER_IS_SYSTEM(m) || getuid() || u->id)`,
where || is concatenation, instead of a random number to choose a value between
0 and RandomizedDelaySec= as the timer delay.
This essentially sets up a fixed, but seemingly random, offset for each timer
iteration rather than having a random offset recalculated each time it fires.

Closes #10355

Co-author: Anita Zhang <the.anitazha@gmail.com>
This commit is contained in:
Kristijan Gjoshev
2020-11-05 10:59:33 -08:00
committed by Anita Zhang
parent 5cecbae158
commit acf24a1a84
10 changed files with 62 additions and 2 deletions
+12
View File
@@ -268,6 +268,18 @@
<varname>AccuracySec=1us</varname>.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>FixedRandomDelay=</varname></term>
<listitem><para>Takes a boolean argument. If true, some amount of time between 0 and
<varname>RandomizedDelaySec=</varname> is chosen and added as the delay for each timer iteration. As this
delay will not be recalculated on each run, this effectively creates a fixed offset for each iteration.
The distribution between 0 and <varname>RandomizedDelaySec=</varname> is deterministic and based on
a combination of the machine ID, whether the timer is run by the user/system manager, the service manager's
user ID, and the timer's unit name. Has no effect if
<varname>RandomizedDelaySec=</varname> is set to 0. Defaults to <option>false</option>.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>OnClockChange=</varname></term>
<term><varname>OnTimezoneChange=</varname></term>