diff --git a/adapter/provider/fetcher.go b/adapter/provider/fetcher.go index 256670f8..c58d7e4d 100644 --- a/adapter/provider/fetcher.go +++ b/adapter/provider/fetcher.go @@ -59,7 +59,7 @@ func (f *fetcher) Initial() (any, error) { isLocal = true if f.interval != 0 && modTime.Add(f.interval).Before(time.Now()) { defer func() { - log.Infoln("[Provider] %s's proxies not updated for a long time") + log.Infoln("[Provider] %s's proxies not updated for a long time, force refresh", f.Name()) go f.update() }() } @@ -160,11 +160,14 @@ func (f *fetcher) update() (same bool, err error) { elm, same, err := f.Update() if err != nil { log.Warnln("[Provider] %s pull error: %s", f.Name(), err.Error()) + return } if same { log.Debugln("[Provider] %s's proxies doesn't change", f.Name()) + return } + if f.onUpdate != nil { f.onUpdate(elm) } diff --git a/rule/provider/fetcher.go b/rule/provider/fetcher.go index 01b9aaa8..89dfd5db 100644 --- a/rule/provider/fetcher.go +++ b/rule/provider/fetcher.go @@ -58,7 +58,7 @@ func (f *fetcher) Initial() (interface{}, error) { hasLocal = true if f.interval != 0 && modTime.Add(f.interval).Before(time.Now()) { defer func() { - log.Infoln("[Provider] %s's rules not updated for a long time", f.Name()) + log.Infoln("[Provider] %s's rules not updated for a long time, force refresh", f.Name()) go f.update() }() } @@ -186,10 +186,12 @@ func (f *fetcher) update() (same bool, err error) { elm, same, err := f.Update() if err != nil { log.Warnln("[Provider] %s pull error: %s", f.Name(), err.Error()) + return } if same { log.Debugln("[Provider] %s's rules doesn't change", f.Name()) + return } log.Infoln("[Provider] %s's rules update", f.Name())