diff --git a/broadcaster.go b/broadcaster.go index e77c2af..b389728 100644 --- a/broadcaster.go +++ b/broadcaster.go @@ -123,7 +123,12 @@ func broadcastWithRedundancyCheck(dryRun bool) { // Mark as broadcast with special timestamp to prevent future selection candidate.BroadcastTime = time.Unix(1, 0) // epoch + 1 second - updateArticle(candidate) + if err := updateArticle(candidate); err != nil { + logInfo("redundancy", "Error updating article", map[string]interface{}{ + "id": candidate.ID, + "error": err.Error(), + }) + } continue // Try next candidate } @@ -189,7 +194,12 @@ func broadcastArticle(chosen Article, dryRun bool) { // Update broadcast time and save to database chosen.BroadcastTime = time.Now() - updateArticle(chosen) + if err := updateArticle(chosen); err != nil { + logInfo("broadcaster", "Error updating article broadcast time", map[string]interface{}{ + "id": chosen.ID, + "error": err.Error(), + }) + } logInfo("broadcaster", "Set broadcast time for article", map[string]interface{}{ "id": chosen.ID, diff --git a/llm.go b/llm.go index ed0bc8e..855299a 100644 --- a/llm.go +++ b/llm.go @@ -108,7 +108,13 @@ func summarizeArticles(ollamaURL, ollamaModel string) { if article.ID == id { article.Summary = result.Summary article.Importance = result.Importance - updateArticle(article) + if err := updateArticle(article); err != nil { + logInfo("summarizer", "Error updating article with summary", map[string]interface{}{ + "id": article.ID, + "error": err.Error(), + }) + continue + } updatedCount++ break } diff --git a/rss.go b/rss.go index 9056a62..2a19ebd 100644 --- a/rss.go +++ b/rss.go @@ -49,16 +49,7 @@ var feeds = map[string]string{ "WSJ": "https://feeds.a.dj.com/rss/RSSWorldNews.xml", } -// Find the maximum abbreviation length -func getMaxAbbreviationLength() int { - maxLen := 0 - for _, abbr := range sourceAbbreviations { - if len(abbr) > maxLen { - maxLen = len(abbr) - } - } - return maxLen -} +// This function was unused and removed to satisfy linter // rssFeedChecker checks RSS feeds every 15 minutes and adds new articles to the database func rssFeedChecker(shutdown chan struct{}, ollamaURL, ollamaModel string) { @@ -102,7 +93,12 @@ func checkRSSFeeds() { a.ID = generateID(a.Link) } articles[a.Link] = a - saveArticle(a) + if err := saveArticle(a); err != nil { + logInfo("rss", "Error saving article", map[string]interface{}{ + "id": a.ID, + "error": err.Error(), + }) + } newCount++ logInfo("new", fmt.Sprintf("Found new article: %s", a.Title), map[string]interface{}{ "id": a.ID,