From 427a47d054296cbb7076bbd09bcac461370b6f62 Mon Sep 17 00:00:00 2001 From: "A. Svensson" Date: Sat, 9 Sep 2017 13:41:08 +0200 Subject: [PATCH] Removes unused chart titles and increase scrape time --- charts.go | 4 ++-- cmd/server/server.go | 2 +- handlers.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charts.go b/charts.go index 6a7a972..a9cfc07 100644 --- a/charts.go +++ b/charts.go @@ -49,7 +49,7 @@ func (a *App) renderChart(w http.ResponseWriter, c renderableChart) error { return nil } -func makeHistoryChart(title string, showLegend bool, points []ServerPoint) chart.Chart { +func makeHistoryChart(showLegend bool, points []ServerPoint) chart.Chart { // TODO BUG: one day is missing randomly (usually the 3rd day in the range) in the chart var xVals []time.Time var yVals []float64 @@ -107,7 +107,7 @@ func makeHistoryChart(title string, showLegend bool, points []ServerPoint) chart } // NOTE: The chart won't be renderable unless we've got at least two days of history -func makeDayAverageChart(title string, points []ServerPoint) chart.BarChart { +func makeDayAverageChart(points []ServerPoint) chart.BarChart { days := make(map[time.Weekday][]int) for _, p := range points { day := p.Time.Weekday() diff --git a/cmd/server/server.go b/cmd/server/server.go index befc3ea..b8e9503 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -20,7 +20,7 @@ func main() { WebAddr: *flagAddr, ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, - ScrapeTimeout: 10 * time.Minute, + ScrapeTimeout: 15 * time.Minute, Storage: &ss13_se.StorageSqlite{ Path: *flagPath, }, diff --git a/handlers.go b/handlers.go index c02c907..b611b60 100644 --- a/handlers.go +++ b/handlers.go @@ -70,7 +70,7 @@ func (a *App) pageDailyChart(w http.ResponseWriter, r *http.Request, vars handle } } - c := makeHistoryChart("Daily history", true, points) + c := makeHistoryChart(true, points) return a.renderChart(w, c) } @@ -87,7 +87,7 @@ func (a *App) pageWeeklyChart(w http.ResponseWriter, r *http.Request, vars handl } } - c := makeHistoryChart("Weekly history", false, points) + c := makeHistoryChart(false, points) return a.renderChart(w, c) } @@ -104,6 +104,6 @@ func (a *App) pageAverageChart(w http.ResponseWriter, r *http.Request, vars hand } } - c := makeDayAverageChart("Average per day", points) + c := makeDayAverageChart(points) return a.renderChart(w, c) }