mirror of
https://github.com/Luzifer/webcheck.git
synced 2024-11-08 06:30:02 +00:00
Fix: Prevent high CPU / cleaning up non existent directory
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9c88c0eeea
commit
0a3219ce4a
1 changed files with 5 additions and 1 deletions
6
main.go
6
main.go
|
@ -184,7 +184,11 @@ func main() {
|
|||
}
|
||||
|
||||
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 != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue