Improved error handling

This commit is contained in:
Frank Denis 2018-01-20 00:30:33 +01:00
parent 7fbb4c5428
commit 1c27d6c230
2 changed files with 72 additions and 91 deletions

View file

@ -187,10 +187,14 @@ func (proxy *Proxy) prefetcher(urlsToPrefetch *[]URLToPrefetch) {
urlToPrefetch := &(*urlsToPrefetch)[i]
if now.After(urlToPrefetch.when) {
dlog.Debugf("Prefetching [%s]", urlToPrefetch.url)
PrefetchSourceURL(urlToPrefetch)
if err := PrefetchSourceURL(urlToPrefetch); err != nil {
dlog.Debugf("Prefetching [%s] failed: %s", err)
} else {
dlog.Debugf("Prefetching [%s] succeeded. Next refresh scheduled for %v", urlToPrefetch.url, urlToPrefetch.when)
}
}
}
time.Sleep(60 * time.Second)
time.Sleep(5 * time.Second)
}
}()
}