Skip to content

Commit

Permalink
all: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Sep 5, 2024
1 parent 022c904 commit 45b2fc6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions internal/aghhttp/aghhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ func ErrorAndLog(
l.ErrorContext(
ctx,
"http error",
"method", r.Method,
"host", r.Host,
"url", r.URL,
"method", r.Method,
"raddr", r.RemoteAddr,
"request_uri", r.RequestURI,
slogutil.KeyError, text,
)

http.Error(w, text, code)
}

Expand Down
6 changes: 3 additions & 3 deletions internal/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,13 @@ func (s *StatsCtx) flushDB(id, limit uint32, ptr *unit) (cont bool, sleepFor tim
if delErr != nil {
// TODO(e.burkov): Improve the algorithm of deleting the oldest bucket
// to avoid the error.
logFunc := s.logger.Warn
lvl := slog.LevelWarn
if !errors.Is(delErr, bbolt.ErrBucketNotFound) {
isCommitable = false
logFunc = s.logger.Error
lvl = slog.LevelError
}

logFunc("deleting bucket", slogutil.KeyError, delErr)
s.logger.Log(context.TODO(), lvl, "deleting bucket", slogutil.KeyError, delErr)
}

return true, 0
Expand Down

0 comments on commit 45b2fc6

Please sign in to comment.