Check log file size more often to prevent huge log files

This commit is contained in:
Michal Horejsek
2020-07-31 13:24:25 +02:00
parent be07cb83c9
commit da381130a3
2 changed files with 6 additions and 1 deletions

View File

@ -152,7 +152,11 @@ func getLogFilename(logPrefix string) string {
func watchLogFileSize(logDir, logPrefix string) {
go func() {
for {
time.Sleep(60 * time.Second)
// Some rare bug can cause log file spamming a lot. Checking file
// size too often is not good, and at the same time postpone next
// check for too long is the same thing. 30 seconds seems as good
// compromise; average computer can generates ~500MB in 30 seconds.
time.Sleep(30 * time.Second)
checkLogFileSize(logDir, logPrefix)
}
}()