diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-02-22 23:06:39 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2021-02-22 23:06:39 +0100 |
commit | bf5001fe2b4d5417e4419cc2195754371fcef03c (patch) | |
tree | 51903344a24ab7b5bec54dd2a70d82cffa507366 /internal/feed/cache/cache_v1.go | |
parent | 7106d5a6e7585dce5fdd552cca30063dd352dc23 (diff) | |
download | feed2imap-go-bf5001fe2b4d5417e4419cc2195754371fcef03c.tar.gz feed2imap-go-bf5001fe2b4d5417e4419cc2195754371fcef03c.tar.bz2 feed2imap-go-bf5001fe2b4d5417e4419cc2195754371fcef03c.zip |
Improve naming
Diffstat (limited to 'internal/feed/cache/cache_v1.go')
-rw-r--r-- | internal/feed/cache/cache_v1.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/feed/cache/cache_v1.go b/internal/feed/cache/cache_v1.go index d754b00..439846f 100644 --- a/internal/feed/cache/cache_v1.go +++ b/internal/feed/cache/cache_v1.go @@ -208,7 +208,7 @@ func (cache *v1Cache) cachedFeed(f *feed.Feed) CachedFeed { return cf } -func newCachedItem(item *feed.Item) cachedItem { +func (cf *cachedFeed) cachedItem(item *feed.Item) cachedItem { var ci cachedItem ci.ID = item.ID @@ -245,8 +245,11 @@ func (cf *cachedFeed) Filter(items []feed.Item, ignoreHash, alwaysNew bool) []fe cacheItems := make(map[cachedItem]*feed.Item, len(items)) for idx := range items { + i := &items[idx] + ci := cf.cachedItem(i) + // remove complete duplicates on the go - cacheItems[newCachedItem(&items[idx])] = &items[idx] + cacheItems[ci] = i } log.Debugf("%d items after deduplication", len(cacheItems)) |