Skip to content

Commit

Permalink
fix(dynamic_conf) fix watch
Browse files Browse the repository at this point in the history
fix(dynamic_conf) fix watch

fix(dynamic_conf) fix watch

fix(dynamic_conf) fix watch
  • Loading branch information
jaronnie committed Dec 19, 2024
1 parent 07bad4b commit 9c49528
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dynamic_conf/fsnotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9c49528

Please sign in to comment.