1
0
Fork 0

Process older entries first

Feed entries are usually ordered from most to least recent.

Processing older entries first ensures that their creation timestamp
is lower than that of newer entries.

This is useful when we order by creation, because then we get a
consistent timeline.
This commit is contained in:
Davide Masserut 2023-03-01 17:58:01 +01:00 committed by Frédéric Guillot
parent ac8f64d7a1
commit 034e46700c
2 changed files with 6 additions and 3 deletions

View file

@ -44,7 +44,10 @@ func ProcessFeedEntries(store *storage.Storage, feed *model.Feed, user *model.Us
// array used for bulk push
entriesToPush := model.Entries{}
for _, entry := range feed.Entries {
// Process older entries first
for i := len(feed.Entries) - 1; i >= 0; i-- {
entry := feed.Entries[i]
logger.Debug("[Processor] Processing entry %q from feed %q", entry.URL, feed.FeedURL)
if isBlockedEntry(feed, entry) || !isAllowedEntry(feed, entry) {

View file

@ -43,7 +43,7 @@ func TestGetAllFeedEntries(t *testing.T) {
t.Fatal(`Filtered entries should be different than previous results`)
}
filteredResultsByEntryID, err := client.FeedEntries(feed.ID, &miniflux.Filter{BeforeEntryID: allResults.Entries[0].ID})
filteredResultsByEntryID, err := client.FeedEntries(feed.ID, &miniflux.Filter{AfterEntryID: allResults.Entries[0].ID})
if err != nil {
t.Fatal(err)
}
@ -83,7 +83,7 @@ func TestGetAllCategoryEntries(t *testing.T) {
t.Fatal(`Filtered entries should be different than previous results`)
}
filteredResultsByEntryID, err := client.CategoryEntries(category.ID, &miniflux.Filter{BeforeEntryID: allResults.Entries[0].ID})
filteredResultsByEntryID, err := client.CategoryEntries(category.ID, &miniflux.Filter{AfterEntryID: allResults.Entries[0].ID})
if err != nil {
t.Fatal(err)
}