mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-09-07 20:39:07 +00:00
Fix: Do not spam events when file is gone for longer
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
50f1e01e3b
commit
5339e866e5
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user