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) {
|
func watchConfigChanges(filename string, evt chan configChangeEvent) {
|
||||||
var (
|
var (
|
||||||
|
available bool
|
||||||
initialized bool
|
initialized bool
|
||||||
size int64
|
size int64
|
||||||
modTime time.Time
|
modTime time.Time
|
||||||
|
@ -31,7 +32,10 @@ func watchConfigChanges(filename string, evt chan configChangeEvent) {
|
||||||
// Fine
|
// Fine
|
||||||
|
|
||||||
case os.IsNotExist(err):
|
case os.IsNotExist(err):
|
||||||
|
if available {
|
||||||
evt <- configChangeEventNotExist
|
evt <- configChangeEventNotExist
|
||||||
|
}
|
||||||
|
available = false
|
||||||
continue
|
continue
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -43,6 +47,7 @@ func watchConfigChanges(filename string, evt chan configChangeEvent) {
|
||||||
evt <- configChangeEventModified
|
evt <- configChangeEventModified
|
||||||
}
|
}
|
||||||
|
|
||||||
|
available = true
|
||||||
initialized = true
|
initialized = true
|
||||||
size = info.Size()
|
size = info.Size()
|
||||||
modTime = info.ModTime()
|
modTime = info.ModTime()
|
||||||
|
|
Loading…
Reference in a new issue