Makes it easier to share the webClient used internally
This commit is contained in:
parent
aa725ad809
commit
3f38424ed9
13
main.go
13
main.go
@ -74,18 +74,19 @@ func (a *App) Run() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
webClient := &http.Client{
|
||||||
|
Timeout: 60 * time.Second,
|
||||||
|
}
|
||||||
|
|
||||||
a.Log("Running updater")
|
a.Log("Running updater")
|
||||||
go a.runUpdater()
|
go a.runUpdater(webClient)
|
||||||
|
|
||||||
|
|
||||||
a.Log("Running server on %s", a.conf.WebAddr)
|
a.Log("Running server on %s", a.conf.WebAddr)
|
||||||
return a.web.ListenAndServe()
|
return a.web.ListenAndServe()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) runUpdater() {
|
func (a *App) runUpdater(webClient *http.Client) {
|
||||||
webClient := &http.Client{
|
|
||||||
Timeout: 60 * time.Second,
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
servers, err := scrapeByond(webClient, now)
|
servers, err := scrapeByond(webClient, now)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user