From 3f38424ed95cf8ab4fe2dcb052a10f025a55f714 Mon Sep 17 00:00:00 2001 From: "A. Svensson" Date: Sat, 15 Jul 2017 19:16:00 +0200 Subject: [PATCH] Makes it easier to share the webClient used internally --- main.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 4d4cb4d..27547b6 100644 --- a/main.go +++ b/main.go @@ -74,18 +74,19 @@ func (a *App) Run() error { return err } + webClient := &http.Client{ + Timeout: 60 * time.Second, + } + a.Log("Running updater") - go a.runUpdater() + go a.runUpdater(webClient) + a.Log("Running server on %s", a.conf.WebAddr) return a.web.ListenAndServe() } -func (a *App) runUpdater() { - webClient := &http.Client{ - Timeout: 60 * time.Second, - } - +func (a *App) runUpdater(webClient *http.Client) { for { now := time.Now() servers, err := scrapeByond(webClient, now)