diff --git a/server/cache.go b/server/cache.go index bb0c3d1..8bc4246 100644 --- a/server/cache.go +++ b/server/cache.go @@ -16,7 +16,7 @@ type stat struct { Summary check.Result `json:"summary"` } -var dayAggregation map[string]map[time.Time]stat +var dayAggregation = make(map[string]map[time.Time]stat) func convertToResult(successCount, totalCount int) check.Result { if successCount >= totalCount*99/100 { @@ -29,6 +29,9 @@ func convertToResult(successCount, totalCount int) check.Result { } func getDay(serviceName string, day time.Time) stat { + if _, ok := dayAggregation[serviceName]; !ok { + dayAggregation[serviceName] = make(map[time.Time]stat) + } if cached, ok := dayAggregation[serviceName][day]; ok { return cached }