Scheduling
This commit is contained in:
parent
43e5689387
commit
41d5de6e8d
|
@ -160,11 +160,11 @@ func ConfigLoad(proxy *Proxy, svcFlag *string, config_file string) error {
|
||||||
source.RefreshDelay = 24
|
source.RefreshDelay = 24
|
||||||
}
|
}
|
||||||
source, sourceUrlsToPrefetch, err := NewSource(source.URL, source.MinisignKeyStr, source.CacheFile, source.FormatStr, time.Duration(source.RefreshDelay)*time.Hour)
|
source, sourceUrlsToPrefetch, err := NewSource(source.URL, source.MinisignKeyStr, source.CacheFile, source.FormatStr, time.Duration(source.RefreshDelay)*time.Hour)
|
||||||
|
proxy.urlsToPrefetch = append(proxy.urlsToPrefetch, sourceUrlsToPrefetch...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dlog.Criticalf("Unable use source [%s]: [%s]", sourceName, err)
|
dlog.Criticalf("Unable use source [%s]: [%s]", sourceName, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
proxy.urlsToPrefetch = append(proxy.urlsToPrefetch, sourceUrlsToPrefetch...)
|
|
||||||
registeredServers, err := source.Parse()
|
registeredServers, err := source.Parse()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dlog.Criticalf("Unable use source [%s]: [%s]", sourceName, err)
|
dlog.Criticalf("Unable use source [%s]: [%s]", sourceName, err)
|
||||||
|
|
|
@ -54,6 +54,8 @@ type App struct {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON")
|
dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON")
|
||||||
|
dlog.Noticef("Starting dnscrypt-proxy %s", AppVersion)
|
||||||
|
|
||||||
cdLocal()
|
cdLocal()
|
||||||
|
|
||||||
svcConfig := &service.Config{
|
svcConfig := &service.Config{
|
||||||
|
@ -99,7 +101,6 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *App) Start(service service.Service) error {
|
func (app *App) Start(service service.Service) error {
|
||||||
dlog.Noticef("Starting dnscrypt-proxy %s", AppVersion)
|
|
||||||
proxy := app.proxy
|
proxy := app.proxy
|
||||||
if err := InitPluginsGlobals(&proxy.pluginsGlobals, &proxy); err != nil {
|
if err := InitPluginsGlobals(&proxy.pluginsGlobals, &proxy); err != nil {
|
||||||
dlog.Fatal(err)
|
dlog.Fatal(err)
|
||||||
|
|
|
@ -123,11 +123,13 @@ func NewSource(url string, minisignKeyStr string, cacheFile string, formatStr st
|
||||||
}
|
}
|
||||||
in, cached, fromBackup, delayTillNextUpdate, err := fetchWithCache(url, cacheFile, refreshDelay)
|
in, cached, fromBackup, delayTillNextUpdate, err := fetchWithCache(url, cacheFile, refreshDelay)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
dlog.Debugf("Scheduling [%s] for prefetch", url)
|
||||||
return source, urlsToPrefetch, err
|
return source, urlsToPrefetch, err
|
||||||
}
|
}
|
||||||
sigCacheFile := cacheFile + ".minisig"
|
sigCacheFile := cacheFile + ".minisig"
|
||||||
sigStr, sigCached, sigFromBackup, sigDelayTillNextUpdate, err := fetchWithCache(sigURL, sigCacheFile, refreshDelay)
|
sigStr, sigCached, sigFromBackup, sigDelayTillNextUpdate, err := fetchWithCache(sigURL, sigCacheFile, refreshDelay)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
dlog.Debugf("Scheduling [%s] for prefetch", sigURL)
|
||||||
return source, urlsToPrefetch, err
|
return source, urlsToPrefetch, err
|
||||||
}
|
}
|
||||||
signature, err := minisign.DecodeSignature(sigStr)
|
signature, err := minisign.DecodeSignature(sigStr)
|
||||||
|
|
Loading…
Reference in New Issue