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

No files matched your search

+5 -4
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)