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

@ -43,6 +43,14 @@ func (f *fetcher) Initial() (any, error) {
err error
isLocal bool
)
defer func() {
// pull proxies automatically
if f.ticker != nil {
go f.pullLoop()
}
}()
if stat, fErr := os.Stat(f.vehicle.Path()); fErr == nil {
buf, err = os.ReadFile(f.vehicle.Path())
modTime := stat.ModTime()
@ -84,11 +92,6 @@ func (f *fetcher) Initial() (any, error) {
f.hash = md5.Sum(buf)
// pull proxies automatically
if f.ticker != nil {
go f.pullLoop()
}
return proxies, nil
}