Skip to content

Commit

Permalink
stats: fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Mar 3, 2023
1 parent e0cbfc1 commit d5a8f24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/stats/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions internal/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d5a8f24

Please sign in to comment.