Fix: Do not spam events when file is gone for longer

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-05-24 18:00:50 +02:00
parent 50f1e01e3b
commit 5339e866e5
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -19,6 +19,7 @@ const (
func watchConfigChanges(filename string, evt chan configChangeEvent) {
var (
available bool
initialized bool
size int64
modTime time.Time
@ -31,7 +32,10 @@ func watchConfigChanges(filename string, evt chan configChangeEvent) {
// Fine
case os.IsNotExist(err):
evt <- configChangeEventNotExist
if available {
evt <- configChangeEventNotExist
}
available = false
continue
default:
@ -43,6 +47,7 @@ func watchConfigChanges(filename string, evt chan configChangeEvent) {
evt <- configChangeEventModified
}
available = true
initialized = true
size = info.Size()
modTime = info.ModTime()