diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-01-20 14:04:19 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-01-20 14:04:19 -0800 |
commit | ffabb009b8e9649eb6450a8edc1ebfdc9fdbb8c3 (patch) | |
tree | f65d5807e49a39bc4561bb0bd823f76ee03041f9 /storage | |
parent | 208cf9892d853a94e5512702c0ff6ed1cafe322a (diff) |
Do not override existing entries when the crawler is enabled
Diffstat (limited to 'storage')
-rw-r--r-- | storage/entry.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/storage/entry.go b/storage/entry.go index d1e8798..5ff5f5c 100644 --- a/storage/entry.go +++ b/storage/entry.go @@ -116,15 +116,17 @@ func (s *Storage) entryExists(entry *model.Entry) bool { return result >= 1 } -// UpdateEntries update a list of entries while refreshing a feed. -func (s *Storage) UpdateEntries(userID, feedID int64, entries model.Entries) (err error) { +// UpdateEntries updates a list of entries while refreshing a feed. +func (s *Storage) UpdateEntries(userID, feedID int64, entries model.Entries, updateExistingEntries bool) (err error) { var entryHashes []string for _, entry := range entries { entry.UserID = userID entry.FeedID = feedID if s.entryExists(entry) { - err = s.updateEntry(entry) + if updateExistingEntries { + err = s.updateEntry(entry) + } } else { err = s.createEntry(entry) } |