fix: provider auto update

This commit is contained in:
Skyxim
2022-05-08 00:04:16 +08:00
parent 663bf4fbb0
commit 2fbbf7519f
6 changed files with 30 additions and 14 deletions

View File

@@ -44,6 +44,12 @@ func (f *fetcher) Initial() (interface{}, error) {
err error
)
defer func() {
if f.ticker != nil {
go f.pullLoop()
}
}()
if stat, fErr := os.Stat(f.vehicle.Path()); fErr == nil {
buf, err = ioutil.ReadFile(f.vehicle.Path())
modTime := stat.ModTime()
@@ -83,9 +89,6 @@ func (f *fetcher) Initial() (interface{}, error) {
}
f.hash = md5.Sum(buf)
if f.ticker != nil {
go f.pullLoop()
}
return rules, nil
}