mirror of https://github.com/jetkvm/kvm.git
fix: NTP requests sleep for 1 hour between attempts.
Fixes #74 - When the device is unable to connect to the time servers, it was looping every two seconds. This lead to unecessary processing, and if the device was able to connect to DNS but not the time servers, it was causing undue load on the DNS server as well.
This commit is contained in:
parent
8ffe66a1bc
commit
7b023a3e8e
2
ntp.go
2
ntp.go
|
@ -20,6 +20,8 @@ func TimeSyncLoop() {
|
|||
err := SyncSystemTime()
|
||||
if err != nil {
|
||||
log.Printf("Failed to sync system time: %v", err)
|
||||
// Sync failed for all 4 endpoints, likely network issue, wait for 1 hour before retrying
|
||||
time.Sleep(1 * time.Hour)
|
||||
continue
|
||||
}
|
||||
log.Printf("Time sync successful, now is: %v, time taken: %v", time.Now(), time.Since(start))
|
||||
|
|
Loading…
Reference in New Issue