diff --git a/dynamic_conf/fsnotify.go b/dynamic_conf/fsnotify.go index 59b0f71..c57b18a 100644 --- a/dynamic_conf/fsnotify.go +++ b/dynamic_conf/fsnotify.go @@ -35,8 +35,12 @@ func (lf *FsNotify) AddListener(listener func()) error { if !ok { return } - if event.Has(fsnotify.Write) { + logx.Infof("%s %s", event.Name, event.Op) + if event.Has(fsnotify.Write) || event.Has(fsnotify.Rename) { listener() + if err := lf.Watcher.Add(event.Name); err != nil { + logx.Errorf("add watch error: %v", err) + } } case err, ok := <-lf.Watcher.Errors: if !ok {