Create more notifications for errors while processing feeds
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
822ad38cfc
commit
3365b38e5a
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user