mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
fix: File.closeOnZero remove unnecessary for loop
This commit is contained in:
parent
4ebe0abba0
commit
5769abb626
1 changed files with 7 additions and 10 deletions
|
@ -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():
|
||||
openedFilesMu.Lock()
|
||||
delete(openedFiles, f.path)
|
||||
openedFilesMu.Unlock()
|
||||
f.File.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
<-f.refCount.Zero()
|
||||
|
||||
openedFilesMu.Lock()
|
||||
delete(openedFiles, f.path)
|
||||
openedFilesMu.Unlock()
|
||||
f.File.Close()
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue