diff --git a/src/github.com/matrix-org/go-neb/polling/polling.go b/src/github.com/matrix-org/go-neb/polling/polling.go index 0a84a92..a131eb6 100644 --- a/src/github.com/matrix-org/go-neb/polling/polling.go +++ b/src/github.com/matrix-org/go-neb/polling/polling.go @@ -1,13 +1,14 @@ package polling import ( + "runtime/debug" + "sync" + "time" + log "github.com/Sirupsen/logrus" "github.com/matrix-org/go-neb/clients" "github.com/matrix-org/go-neb/database" "github.com/matrix-org/go-neb/types" - "runtime/debug" - "sync" - "time" ) // Remember when we first started polling on this service ID. Polling routines will @@ -107,7 +108,6 @@ func pollLoop(service types.Service, ts int64) { break } now := time.Now() - logger.Info("Sleeping for ", nextTime.Sub(now)) time.Sleep(nextTime.Sub(now)) if pollTimeChanged(service, ts) { diff --git a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go index 5ddbe54..b9c32d4 100644 --- a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go +++ b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go @@ -175,6 +175,11 @@ func (s *Service) OnPoll(cli *matrix.Client) time.Time { continue } incrementMetrics(u, nil) + logger.WithFields(log.Fields{ + "feed_url": u, + "feed_items": len(feed.Items), + "new_items": len(items), + }).Info("Sending new items") // Loop backwards since [0] is the most recent and we want to send in chronological order for i := len(items) - 1; i >= 0; i-- { item := items[i] @@ -290,8 +295,17 @@ func (s *Service) queryFeed(feedURL string) (*gofeed.Feed, []gofeed.Item, error) guids = append(guids, itm.GUID) } - // Update the service config to persist the new times f := s.Feeds[feedURL] + + if len(guids) != len(f.RecentGUIDs) { + log.WithFields(log.Fields{ + "new_guids": guids, + "old_guids": f.RecentGUIDs, + "feed_url": feedURL, + }).Warn("GUID length mismatch") + } + + // Update the service config to persist the new times f.NextPollTimestampSecs = nextPollTsSec f.FeedUpdatedTimestampSecs = now f.RecentGUIDs = guids