Pull request 1796: 5661-opt-more-lock

Updates #5661.

Squashed commit of the following:

commit 0a1425df0ea1278c73ac88cbee053897d3daaf1b
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri Mar 31 18:31:19 2023 +0300

    querylog: opt locks more
This commit is contained in:
Ainar Garipov
2023-03-31 18:44:51 +03:00
parent f191cb07a5
commit 3575aa0570
6 changed files with 54 additions and 50 deletions

View File

@@ -167,8 +167,8 @@ 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()
l.confMu.RLock()
defer l.confMu.RUnlock()
oldest, err := l.readFileFirstTimeValue()
if err != nil && !errors.Is(err, os.ErrNotExist) {