diff --git a/internal/stats/http.go b/internal/stats/http.go index 38ab5bba..6963a410 100644 --- a/internal/stats/http.go +++ b/internal/stats/http.go @@ -144,7 +144,7 @@ func (s *StatsCtx) handleStatsConfig(w http.ResponseWriter, r *http.Request) { defer s.lock.Unlock() limit := time.Duration(reqData.IntervalDays) * timeutil.Day - s.setLimitLocked(limit) + s.setLimit(limit) } // handlePutStatsConfig handles requests to the PUT /control/stats/config/update diff --git a/internal/stats/stats.go b/internal/stats/stats.go index fb5b8685..9f03fdee 100644 --- a/internal/stats/stats.go +++ b/internal/stats/stats.go @@ -452,14 +452,14 @@ func (s *StatsCtx) periodicFlush() { log.Debug("periodic flushing finished") } -// setLimitLocked sets the limit without locking. For internal use only. +// setLimit sets the limit. s.lock is expected to be locked. // // TODO(s.chzhen): Remove it when migration to the new API is over. -func (s *StatsCtx) setLimitLocked(limit time.Duration) { +func (s *StatsCtx) setLimit(limit time.Duration) { if limit != 0 { s.enabled = true s.limit = limit - log.Debug("stats: set limit: %d days", int(limit/timeutil.Day)) + log.Debug("stats: set limit: %d days", limit/timeutil.Day) return }