This commit is contained in:
jdl
2026-06-15 19:06:12 +02:00
parent 458e1ac603
commit c47d00e694
7 changed files with 13 additions and 13 deletions

View File

@@ -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)