mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +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().
|
defer logger.Debug().
|
||||||
Str("path", f.path).
|
Str("path", f.path).
|
||||||
Msg("access log closed")
|
Msg("access log closed")
|
||||||
for {
|
|
||||||
select {
|
<-f.refCount.Zero()
|
||||||
case <-f.refCount.Zero():
|
|
||||||
openedFilesMu.Lock()
|
openedFilesMu.Lock()
|
||||||
delete(openedFiles, f.path)
|
delete(openedFiles, f.path)
|
||||||
openedFilesMu.Unlock()
|
openedFilesMu.Unlock()
|
||||||
f.File.Close()
|
f.File.Close()
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue