mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-12-20 11:51:17 +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
1 changed files with 6 additions and 1 deletions
|
@ -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):
|
||||
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 a new issue