From 7e2f4a85ab0e4503262244281a348b7e8cd9e6f1 Mon Sep 17 00:00:00 2001 From: siddharth Date: Sun, 28 Nov 2021 23:35:27 -0500 Subject: feed: update Process Make a copy of `entry` into `e` in the loop that processes all Entries. Then use `e` instead of `entry`. --- feed/feed.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'feed/feed.go') diff --git a/feed/feed.go b/feed/feed.go index 25fc97d..7e0df4c 100644 --- a/feed/feed.go +++ b/feed/feed.go @@ -126,13 +126,14 @@ func (feed *Feed) Process(pState *state.ProcessState) { // Channel for receiving entry results. erChan := make(chan state.EntryResult) for i, entry := range feed.Entries { + e := entry // Process entry only if it was not downloaded before. - if !pState.DB.Exists(feed.Id, entry.Id) { - go feed.processEntry(entry, erChan) + if !pState.DB.Exists(feed.Id, e.Id) { + go feed.processEntry(e, erChan) processing += 1 } else { fmt.Printf("[%s][%s]: Already downloaded '%s' before\n", - feed.Id, entry.Id, entry.Title) + feed.Id, e.Id, e.Title) } // Process only `feed.Last` entries. -- cgit v1.2.3