summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-11-28 23:35:27 -0500
committersiddharth <s@ricketyspace.net>2021-11-28 23:35:27 -0500
commit7e2f4a85ab0e4503262244281a348b7e8cd9e6f1 (patch)
treef0fac7647e82a57c1ef24e7be6a0bf8a105426d2
parentc78ce3ff4e7d5d1dfc79baaae646b9d2e3a55fee (diff)
feed: update Process
Make a copy of `entry` into `e` in the loop that processes all Entries. Then use `e` instead of `entry`.
-rw-r--r--feed/feed.go7
1 files changed, 4 insertions, 3 deletions
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.