Browse Source

Merge pull request #134 from matrix-org/kegan/rss-dont-replace-if-no-guids

Treat RSS feeds with 0 items as errors
pull/135/head
Kegsay 8 years ago
committed by GitHub
parent
commit
357abef22c
  1. 6
      src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

6
src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

@ -241,6 +241,12 @@ func (s *Service) queryFeed(feedURL string) (*gofeed.Feed, []gofeed.Item, error)
fp := gofeed.NewParser()
fp.Client = cachingClient
feed, err := fp.ParseURL(feedURL)
// check for no items in addition to any returned errors as it appears some RSS feeds
// do not consistently return items.
if err == nil && len(feed.Items) == 0 {
err = errors.New("feed has 0 items")
}
if err != nil {
f := s.Feeds[feedURL]
f.IsFailing = true

Loading…
Cancel
Save