mirror of https://github.com/jetkvm/kvm.git
fix: make timesync non-blocking
This commit is contained in:
parent
02382e4632
commit
d02ae062e4
|
|
@ -91,9 +91,11 @@ func triggerTimeSyncOnNetworkStateChange() {
|
|||
}
|
||||
|
||||
// sync time
|
||||
if err := timeSync.Sync(); err != nil {
|
||||
networkLogger.Error().Err(err).Msg("failed to sync time after network state change")
|
||||
}
|
||||
go func() {
|
||||
if err := timeSync.Sync(); err != nil {
|
||||
networkLogger.Error().Err(err).Msg("failed to sync time after network state change")
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func networkStateChanged(_ string, state types.InterfaceState) {
|
||||
|
|
|
|||
|
|
@ -120,12 +120,12 @@ func (im *InterfaceManager) updateInterfaceStateAddresses(nl *link.Link) (bool,
|
|||
}
|
||||
}
|
||||
|
||||
if !compareStringSlices(im.state.IPv4Addresses, ipv4Addresses) {
|
||||
if !sortAndCompareStringSlices(im.state.IPv4Addresses, ipv4Addresses) {
|
||||
im.state.IPv4Addresses = ipv4Addresses
|
||||
stateChanged = true
|
||||
}
|
||||
|
||||
if !compareIPv6AddressSlices(im.state.IPv6Addresses, ipv6Addresses) {
|
||||
if !sortAndCompareIPv6AddressSlices(im.state.IPv6Addresses, ipv6Addresses) {
|
||||
im.state.IPv6Addresses = ipv6Addresses
|
||||
stateChanged = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func lifetimeToTime(lifetime int) *time.Time {
|
|||
return &t
|
||||
}
|
||||
|
||||
func compareStringSlices(a, b []string) bool {
|
||||
func sortAndCompareStringSlices(a, b []string) bool {
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ func compareStringSlices(a, b []string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func compareIPv6AddressSlices(a, b []types.IPv6Address) bool {
|
||||
func sortAndCompareIPv6AddressSlices(a, b []types.IPv6Address) bool {
|
||||
if len(a) != len(b) {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue