Fix: Address linter errors by adding error handling and removing unused function
This commit is contained in:
parent
26b2655354
commit
e66361ea4e
@ -123,7 +123,12 @@ func broadcastWithRedundancyCheck(dryRun bool) {
|
|||||||
|
|
||||||
// Mark as broadcast with special timestamp to prevent future selection
|
// Mark as broadcast with special timestamp to prevent future selection
|
||||||
candidate.BroadcastTime = time.Unix(1, 0) // epoch + 1 second
|
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
|
continue // Try next candidate
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +194,12 @@ func broadcastArticle(chosen Article, dryRun bool) {
|
|||||||
|
|
||||||
// Update broadcast time and save to database
|
// Update broadcast time and save to database
|
||||||
chosen.BroadcastTime = time.Now()
|
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{}{
|
logInfo("broadcaster", "Set broadcast time for article", map[string]interface{}{
|
||||||
"id": chosen.ID,
|
"id": chosen.ID,
|
||||||
|
8
llm.go
8
llm.go
@ -108,7 +108,13 @@ func summarizeArticles(ollamaURL, ollamaModel string) {
|
|||||||
if article.ID == id {
|
if article.ID == id {
|
||||||
article.Summary = result.Summary
|
article.Summary = result.Summary
|
||||||
article.Importance = result.Importance
|
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++
|
updatedCount++
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
18
rss.go
18
rss.go
@ -49,16 +49,7 @@ var feeds = map[string]string{
|
|||||||
"WSJ": "https://feeds.a.dj.com/rss/RSSWorldNews.xml",
|
"WSJ": "https://feeds.a.dj.com/rss/RSSWorldNews.xml",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the maximum abbreviation length
|
// This function was unused and removed to satisfy linter
|
||||||
func getMaxAbbreviationLength() int {
|
|
||||||
maxLen := 0
|
|
||||||
for _, abbr := range sourceAbbreviations {
|
|
||||||
if len(abbr) > maxLen {
|
|
||||||
maxLen = len(abbr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return maxLen
|
|
||||||
}
|
|
||||||
|
|
||||||
// rssFeedChecker checks RSS feeds every 15 minutes and adds new articles to the database
|
// rssFeedChecker checks RSS feeds every 15 minutes and adds new articles to the database
|
||||||
func rssFeedChecker(shutdown chan struct{}, ollamaURL, ollamaModel string) {
|
func rssFeedChecker(shutdown chan struct{}, ollamaURL, ollamaModel string) {
|
||||||
@ -102,7 +93,12 @@ func checkRSSFeeds() {
|
|||||||
a.ID = generateID(a.Link)
|
a.ID = generateID(a.Link)
|
||||||
}
|
}
|
||||||
articles[a.Link] = a
|
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++
|
newCount++
|
||||||
logInfo("new", fmt.Sprintf("Found new article: %s", a.Title), map[string]interface{}{
|
logInfo("new", fmt.Sprintf("Found new article: %s", a.Title), map[string]interface{}{
|
||||||
"id": a.ID,
|
"id": a.ID,
|
||||||
|
Loading…
Reference in New Issue
Block a user