add func to store for getting single service status

and use that in the watchdog
This commit is contained in:
Chris Heppell
2020-12-31 20:33:35 +00:00
parent 5eb289c4d3
commit 4d24a4d647
2 changed files with 14 additions and 4 deletions

View File

@ -30,10 +30,8 @@ func GetServiceStatusesAsJSON() ([]byte, error) {
// GetUptimeByServiceGroupAndName returns the uptime of a service based on its group and name
func GetUptimeByServiceGroupAndName(group, name string) *core.Uptime {
key := fmt.Sprintf("%s_%s", group, name)
serviceStatuses := store.GetAll()
serviceStatus, exists := serviceStatuses[key]
if !exists {
serviceStatus := store.GetServiceStatus(group, name)
if serviceStatus == nil {
return nil
}
return serviceStatus.Uptime