diff --git a/cmd/eksterd/memory.go b/cmd/eksterd/memory.go index c54ede3..6b98355 100644 --- a/cmd/eksterd/memory.go +++ b/cmd/eksterd/memory.go @@ -343,22 +343,21 @@ func (b *memoryBackend) RefreshFeeds() { for uid := range feeds { for _, feedURL := range feeds[uid] { - log.Println(feedURL) + log.Println("Processing", feedURL) resp, err := b.Fetch3(uid, feedURL) if err != nil { - _ = b.channelAddItem("notifications", microsub.Item{ - Type: "entry", - Name: "Error while fetching feed", - Content: µsub.Content{ - Text: fmt.Sprintf("Error while updating feed %s: %v", feedURL, err), - }, - UID: time.Now().String(), - }) - count++ log.Printf("Error while Fetch3 of %s: %v\n", feedURL, err) + b.addNotification("Error while fetching feed", feedURL, err) + count++ + continue + } + err = b.ProcessContent(uid, feedURL, resp.Header.Get("Content-Type"), resp.Body) + if err != nil { + log.Printf("Error while processing content for %s: %v\n", feedURL, err) + b.addNotification("Error while processing feed", feedURL, err) + count++ continue } - _ = b.ProcessContent(uid, feedURL, resp.Header.Get("Content-Type"), resp.Body) _ = resp.Body.Close() } } @@ -368,6 +367,17 @@ func (b *memoryBackend) RefreshFeeds() { } } +func (b *memoryBackend) addNotification(name string, feedURL string, err error) { + _ = b.channelAddItem("notifications", microsub.Item{ + Type: "entry", + Name: name, + Content: µsub.Content{ + Text: fmt.Sprintf("Error while updating feed %s: %v", feedURL, err), + }, + UID: time.Now().String(), + }) +} + func (b *memoryBackend) TimelineGet(before, after, channel string) (microsub.Timeline, error) { log.Printf("TimelineGet %s\n", channel)