diff --git a/server/metrics/metrics.go b/server/metrics/metrics.go index abbcac4..805515a 100644 --- a/server/metrics/metrics.go +++ b/server/metrics/metrics.go @@ -151,11 +151,13 @@ func (mh *monitorHistory) Months() []float64 { } func (mh *monitorHistory) Report(w *bufio.Writer) { + mh.lock.Lock() fmt.Fprintln(w, "Minutes:", reportLine(mh.monitorType, mh.perMinutePerHour[:])) fmt.Fprintln(w, "Hours: ", reportLine(mh.monitorType, mh.perHourForDay[:])) fmt.Fprintln(w, "Days: ", reportLine(mh.monitorType, mh.perDayForWeek[:])) fmt.Fprintln(w, "Weeks: ", reportLine(mh.monitorType, mh.perWeekForMonth[:])) fmt.Fprintln(w, "Months: ", reportLine(mh.monitorType, mh.perMonthForYear[:])) + mh.lock.Unlock() } func reportLine(t MonitorType, array []float64) string {