Browse Source

Merge pull request #176 from matrix-org/kegan/rss-limits

Increase the max number of GUIDs we keep per RSS feed
pull/188/head
Kegsay 7 years ago
committed by GitHub
parent
commit
01a5a3fc88
  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

@ -281,13 +281,13 @@ func (s *Service) queryFeed(feedURL string) (*gofeed.Feed, []gofeed.Item, error)
// Some RSS feeds can return a very small number of items then bounce
// back to their "normal" size, so we cannot just clobber the recent GUID list per request or else we'll
// forget what we sent and resend it. Instead, we'll keep 2x the max number of items that we've ever
// seen from this feed, up to a max of 1000.
// seen from this feed, up to a max of 10,000.
maxGuids := 2 * len(feed.Items)
if len(f.RecentGUIDs) > maxGuids {
maxGuids = len(f.RecentGUIDs) // already 2x'd.
}
if maxGuids > 1000 {
maxGuids = 1000
if maxGuids > 10000 {
maxGuids = 10000
}
lastSet := uniqueStrings(f.RecentGUIDs) // e.g. [4,5,6]

Loading…
Cancel
Save