From d407ac084089e58b15efef8681fcaad1e600718f Mon Sep 17 00:00:00 2001 From: lakshit verma Date: Fri, 21 Aug 2026 21:44:48 +0530 Subject: [PATCH] loglist: error when every log list source fails FetchAll swallowed per-source errors and always returned nil, so all three upstreams failing was indistinguishable from an empty log list and the hourly sync silently tailed nothing. Total failure now returns an error; partial failure logs a warning. --- internal/loglist/loglist.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/loglist/loglist.go b/internal/loglist/loglist.go index 716fbb0..b8f33b2 100644 --- a/internal/loglist/loglist.go +++ b/internal/loglist/loglist.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "time" ) @@ -89,11 +90,13 @@ func FetchAll(client *http.Client) ([]Log, error) { urls := []string{ChromeList, ChromeAllList, AppleList} seen := make(map[string]*Log) var order []string + var fetched int for _, u := range urls { list, err := fetchOne(client, u) if err != nil { continue } + fetched++ for i := range list.Operators { for j := range list.Operators[i].Logs { lg := &list.Operators[i].Logs[j] @@ -121,6 +124,12 @@ func FetchAll(client *http.Client) ([]Log, error) { for _, id := range order { out = append(out, *seen[id]) } + if fetched == 0 { + return nil, fmt.Errorf("all %d log list sources failed", len(urls)) + } + if fetched < len(urls) { + log.Printf("loglist: %d of %d sources failed", len(urls)-fetched, len(urls)) + } return out, nil }