1
0
Fork 0
mirror of https://github.com/Luzifer/webcheck.git synced 2024-11-09 23:20:03 +00:00

Fix: Prevent high CPU / cleaning up non existent directory

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-07-24 11:02:49 +02:00
parent 9c88c0eeea
commit 0a3219ce4a
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -184,7 +184,11 @@ func main() {
} }
func cleanupLogFiles() { func cleanupLogFiles() {
for { for range time.Tick(10 * time.Second) {
if info, err := os.Stat(cfg.LogDir); err != nil || !info.IsDir() {
continue
}
if err := filepath.Walk(cfg.LogDir, func(path string, info os.FileInfo, err error) error { if err := filepath.Walk(cfg.LogDir, func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
return err return err