Cleanup.
This commit is contained in:
@@ -62,13 +62,15 @@ func (hp *HubPoller) Run() {
|
||||
hp.apply(state)
|
||||
}
|
||||
|
||||
hp.poll()
|
||||
client := &http.Client{Timeout: 32 * time.Second}
|
||||
|
||||
hp.poll(client)
|
||||
for range time.Tick(hubPollInterval) {
|
||||
hp.poll()
|
||||
hp.poll(client)
|
||||
}
|
||||
}
|
||||
|
||||
func (hp *HubPoller) poll() {
|
||||
func (hp *HubPoller) poll(client *http.Client) {
|
||||
req, err := http.NewRequest(http.MethodGet, hp.hubURL, nil)
|
||||
if err != nil {
|
||||
log.Printf("[HubPoller] build request: %v", err)
|
||||
@@ -76,7 +78,6 @@ func (hp *HubPoller) poll() {
|
||||
}
|
||||
req.SetBasicAuth("", hp.apiKey)
|
||||
|
||||
client := &http.Client{Timeout: 32 * time.Second}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Printf("[HubPoller] fetch: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user