mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
* many: wait for up to 10min for NTP syncronization before autorefresh
We got bugreports that on systems without a proper clock the
auto-refresh code gets confused and reports strange refresh times.
It looks like this is triggered by snapd starting up and while in
the middle of the startup the NTP sync happens and that confuses
the autorefresh code that tries to calculate the next refresh window
because the clock is jumping.
To avoid this happening this commit adds code that waits for up
to 10min for the NTP syncronization to happen. This does not
fully eliminate the bug (that we still don't fully understand)
but it should fix it for most systems that have some sort of
network connection.
* {device,snap}state: rework ntp sync detection
* devicestate: rename/move ntpSyncedOrWaitedLongerThan
* timeutil: add missing dbus based tests
* devicestate: add tests around CanAutoRefresh and ntpSyncedOrWaitedLongerThan
* devicestate: clarify comments around TestNTPSyncedOrWaitedLongerThan
* devicestate: use time.Minute (thanks to Alberto)
* devicestate: use time.Nanosecond explicitely (thanks to Alberto)
* devicestate,timeutil: add/use timeutil.NoTimedate1Error
* timeutil: adjust test for new behavior
* devicestate: use errors.As and make test more realistic by using NoTimedate1Error.Err
* timeutil: remove unused code (thanks to Maciej)
* devicestate: ensure m.ntpSynchronized is cached and this is tested
* timeutil: fix misleading comment
* timeutil: fix typo (thank to Ian)
* devicestate: rename ntpSynchronized->ntpSyncedOrTimedOut to better reflect what it's about