Skip to content

Commit

Permalink
feat: improve fetching all feeds by ignoring failed ones
Browse files Browse the repository at this point in the history
  • Loading branch information
TypicalAM committed Aug 20, 2023
1 parent fd6a9b0 commit e0d1b1d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/backend/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ func (c *Cache) GetArticlesBulk(urls []string, ignoreCache bool) SortableArticle
for _, url := range urls {
if items, err := c.GetArticles(url, ignoreCache); err == nil {
result = append(result, items...)
} else {
// NOTE: Let's say you have 50 feeds and 5 fail, we don't want to keep trying failed feeds
// so we just fill the cache with an empty item. That way load for bulk feeds is faster next time.
log.Println("Error getting articles for", url, err, "filling with empty item")
c.Content[url] = Entry{time.Now().Add(DefaultCacheDuration), SortableArticles{}}
}
}

Expand Down

0 comments on commit e0d1b1d

Please sign in to comment.