gs-update-monitor: Delay update time with larger random interval
It has been reported that some mirroring infrastructure sites are suffering traffic spikes from update monitor from 6 to 7am. This commit tries to resolve this issue by adding a randomized hour parameter in [0, 6). A more sophisticated strategy might be necessary if this problem still exists after this commit, to both let users get updates automatically, and not stressing infrastructure.
Fixes #2410 (closed).
Considerations for this new strategy:
- The changes to the codebase are minimal, making it easy to backport to older versions, which helps adoption in older Linux distributions.
-
monitor->randomized_hour
is set to [0, 6) instead of [0, 12) to avoid this scenario: if the randomization chooses 11, but user tend to suspend their desktop computer before 5pm, automatic updates would never occur. (Suspend would not let gnome-software daemon quit?) - While I believe it would also be acceptable to allow updates after X am where X is in [0, 12), the code currently uses 6am as an arbitrary reference point, so I'm maintaining this in the current merge request.