remove debug logs and panic if auto refresh failed

This commit is contained in:
Tordarus 2025-02-02 10:59:05 +01:00
parent 1fd0ecc167
commit 8bf2e7b687

View File

@ -50,7 +50,11 @@ func main() {
panic(err) panic(err)
} }
go api.AutoRefresh(context.Background()) go func() {
if err := api.AutoRefresh(context.Background()); err != nil {
panic(err)
}
}()
go func() { go func() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@ -71,7 +75,6 @@ func main() {
lastTick := time.Now() lastTick := time.Now()
for now := range ticker.C { for now := range ticker.C {
CurrentTraffic = CalculateSiteTraffic(api, sites, now.Sub(lastTick)) CurrentTraffic = CalculateSiteTraffic(api, sites, now.Sub(lastTick))
fmt.Println(CurrentTraffic)
lastTick = now lastTick = now
} }
} }