fix: File.closeOnZero remove unnecessary for loop

This commit is contained in:
yusing 2025-01-09 18:42:51 +08:00
parent 4ebe0abba0
commit 5769abb626

View file

@ -58,14 +58,11 @@ func (f *File) closeOnZero() {
defer logger.Debug().
Str("path", f.path).
Msg("access log closed")
for {
select {
case <-f.refCount.Zero():
<-f.refCount.Zero()
openedFilesMu.Lock()
delete(openedFiles, f.path)
openedFilesMu.Unlock()
f.File.Close()
return
}
}
}