chore: apply config when geo update

This commit is contained in:
Larvan2
2024-05-19 15:46:23 +08:00
parent df69a31e62
commit c3ee921d30
3 changed files with 60 additions and 38 deletions

18
main.go
View File

@@ -113,9 +113,23 @@ func main() {
}
if C.GeoAutoUpdate {
updater.RegisterGeoUpdater()
}
updateNotification := make(chan struct{})
go updater.RegisterGeoUpdater(updateNotification)
go func() {
for range updateNotification {
cfg, err := executor.ParseWithPath(C.Path.Config())
if err != nil {
log.Errorln("[GEO] update GEO databases failed: %v", err)
return
}
log.Warnln("[GEO] update GEO databases success, applying config")
executor.ApplyConfig(cfg, false)
}
}()
}
defer executor.Shutdown()
termSign := make(chan os.Signal, 1)