summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/log/rotate.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/internal/log/rotate.go b/internal/log/rotate.go
index 27907ce..2971f70 100644
--- a/internal/log/rotate.go
+++ b/internal/log/rotate.go
@@ -50,8 +50,6 @@ func (fr *FileRotater) open() error {
}
func (fr *FileRotater) trim() error {
- fr.mu.Lock()
- defer fr.mu.Unlock()
// We need to seek to the trim size to skip over that part as we discard it
_, err := fr.file.Seek(TrimSize, io.SeekStart)
if err != nil {
@@ -85,6 +83,8 @@ func (fr *FileRotater) trim() error {
// Write implements io.Writer for the log rotater
func (fr *FileRotater) Write(p []byte) (n int, err error) {
+ fr.mu.Lock()
+ defer fr.mu.Unlock()
fi, err := fr.file.Stat()
if err != nil {
return 0, err