all: imp code

This commit is contained in:
Stanislav Chzhen 2024-09-05 18:07:06 +03:00
parent 022c90496a
commit 45b2fc6a05
2 changed files with 7 additions and 5 deletions

View File

@ -57,11 +57,13 @@ func ErrorAndLog(
l.ErrorContext( l.ErrorContext(
ctx, ctx,
"http error", "http error",
"method", r.Method,
"host", r.Host, "host", r.Host,
"url", r.URL, "method", r.Method,
"raddr", r.RemoteAddr,
"request_uri", r.RequestURI,
slogutil.KeyError, text, slogutil.KeyError, text,
) )
http.Error(w, text, code) http.Error(w, text, code)
} }

View File

@ -466,13 +466,13 @@ func (s *StatsCtx) flushDB(id, limit uint32, ptr *unit) (cont bool, sleepFor tim
if delErr != nil { if delErr != nil {
// TODO(e.burkov): Improve the algorithm of deleting the oldest bucket // TODO(e.burkov): Improve the algorithm of deleting the oldest bucket
// to avoid the error. // to avoid the error.
logFunc := s.logger.Warn lvl := slog.LevelWarn
if !errors.Is(delErr, bbolt.ErrBucketNotFound) { if !errors.Is(delErr, bbolt.ErrBucketNotFound) {
isCommitable = false 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 return true, 0