Add error handling to notify

This commit is contained in:
2024-08-25 21:49:41 +02:00
parent 3b43378184
commit 77283822fd

10
main.go
View File

@@ -57,9 +57,15 @@ func main() {
WatchRecursively(root, func(event fsnotify.Event) {
if !queued {
delay := 5*time.Minute
delay := 5 * time.Minute
log.Printf("Mailing changes in %v seconds", delay.Seconds())
time.AfterFunc(delay, func() { doNotify() })
time.AfterFunc(delay, func() {
err := doNotify()
if err != nil {
Error.Printf("Error sending mail: %v", err)
return
}
})
queued = true
}
changes = append(changes, &event)