Skip to content

Commit

Permalink
Cherry-Pick Txn log level change into 'master' (#1481)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Aug 28, 2024
2 parents 1ed897e + 3b7130a commit 85e9d3f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"lukechampine.com/frand"
)

Expand Down Expand Up @@ -172,7 +173,11 @@ LOOP:
if sleep > maxBackoff {
sleep = maxBackoff
}
log.Warn("database locked", zap.Duration("elapsed", time.Since(attemptStart)), zap.Duration("totalElapsed", time.Since(start)), zap.Stack("stack"), zap.Duration("retry", sleep))
lvl := zapcore.DebugLevel
if time.Since(start) > time.Second {
lvl = zapcore.WarnLevel
}
log.Log(lvl, "database locked", zap.Duration("elapsed", time.Since(attemptStart)), zap.Duration("totalElapsed", time.Since(start)), zap.Stack("stack"), zap.Duration("retry", sleep))

select {
case <-ctx.Done():
Expand Down

0 comments on commit 85e9d3f

Please sign in to comment.