libs/autofile: bring back loops

This commit is contained in:
Ethan Buchman
2018-08-22 15:53:14 -04:00
parent 013b9cef64
commit 1bd9db31bc
2 changed files with 15 additions and 11 deletions
+7 -5
View File
@@ -67,11 +67,13 @@ func (af *AutoFile) Close() error {
}
func (af *AutoFile) processTicks() {
select {
case <-af.ticker.C:
af.closeFile()
case <-af.tickerStopped:
return
for {
select {
case <-af.ticker.C:
af.closeFile()
case <-af.tickerStopped:
return
}
}
}
+8 -6
View File
@@ -199,12 +199,14 @@ func (g *Group) Flush() error {
}
func (g *Group) processTicks() {
select {
case <-g.ticker.C:
g.checkHeadSizeLimit()
g.checkTotalSizeLimit()
case <-g.Quit():
return
for {
select {
case <-g.ticker.C:
g.checkHeadSizeLimit()
g.checkTotalSizeLimit()
case <-g.Quit():
return
}
}
}