diff --git a/pkg/storygraph/client.go b/pkg/storygraph/client.go index 5bc4393..79dc232 100644 --- a/pkg/storygraph/client.go +++ b/pkg/storygraph/client.go @@ -110,7 +110,7 @@ func GetLatestBooks() (map[string]*Book, error) { func getRating(bookID string) string { resp, err := c.Get(fmt.Sprintf("https://app.thestorygraph.com/books/%s/community_reviews", bookID)) if err != nil { - fmt.Println("Error fetching book rating:", resp.StatusCode) + fmt.Println("Error fetching book rating:", err) return "0.0" } defer resp.Body.Close() diff --git a/pkg/storygraph/http.go b/pkg/storygraph/http.go index 2c0ea07..4c1f55f 100644 --- a/pkg/storygraph/http.go +++ b/pkg/storygraph/http.go @@ -52,6 +52,7 @@ func (h *HTTPClient) Get(url string) (*http.Response, error) { if resp.StatusCode == 429 { fmt.Println("Rate limit exceeded, retrying...") h.retries-- + time.Sleep(30 * time.Second) continue }