Skip to content

Commit

Permalink
fix mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Feb 10, 2023
1 parent 9374cf0 commit c569c7b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/querylog/querylogfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ func (l *queryLog) periodicRotate() {
// checkAndRotate rotates log files if those are older than the specified
// rotation interval.
func (l *queryLog) checkAndRotate() {
l.lock.Lock()
defer l.lock.Unlock()

oldest, err := l.readFileFirstTimeValue()
if err != nil && !errors.Is(err, os.ErrNotExist) {
log.Error("querylog: reading oldest record for rotation: %s", err)
Expand Down

0 comments on commit c569c7b

Please sign in to comment.