handled checkin time comparison for health better

This commit is contained in:
0xdcarns 2022-05-23 10:02:28 -04:00
parent f2ca830106
commit aed80d0886

View file

@ -67,6 +67,7 @@ func GetSingleNetworkView(network string) fyne.CanvasObject {
LoadingNotify() LoadingNotify()
nets, err := functions.List(network) nets, err := functions.List(network)
if err != nil || len(nets) < 1 { if err != nil || len(nets) < 1 {
ClearNotification()
return container.NewCenter(widget.NewLabel("No data retrieved.")) return container.NewCenter(widget.NewLabel("No data retrieved."))
} }
var nodecfg config.ClientConfig var nodecfg config.ClientConfig
@ -79,10 +80,10 @@ func GetSingleNetworkView(network string) fyne.CanvasObject {
privateAddr6 := nodecfg.Node.Address6 privateAddr6 := nodecfg.Node.Address6
endpoint := nodecfg.Node.Endpoint endpoint := nodecfg.Node.Endpoint
health := " (HEALTHY)" health := " (HEALTHY)"
if time.Now().After(lastCheckInTime.Add(time.Minute * 5)) { if time.Now().After(lastCheckInTime.Add(time.Minute * 30)) {
health = " (WARNING)"
} else if time.Now().After(lastCheckInTime.Add(time.Minute * 30)) {
health = " (ERROR)" health = " (ERROR)"
} else if time.Now().After(lastCheckInTime.Add(time.Minute * 5)) {
health = " (WARNING)"
} }
lastCheckIn += health lastCheckIn += health
version := nodecfg.Node.Version version := nodecfg.Node.Version