From 472b306dbfb63b97b24302698cbebd1f501ed920 Mon Sep 17 00:00:00 2001 From: balki <3070606-balki@users.noreply.gitlab.com> Date: Fri, 13 May 2022 13:56:34 -0400 Subject: [PATCH] Fix loop var in concurrent download --- app/app.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 3244e51..9dd39e8 100644 --- a/app/app.go +++ b/app/app.go @@ -38,7 +38,8 @@ func Run(configPath string) { tgram := telegram.NewTelegramSender(tgramProxy, cfg.TelegramAuthToken) wg := sync.WaitGroup{} - for _, feed := range cfg.Feeds { + for i := range cfg.Feeds { + feed := &cfg.Feeds[i] log.Info("processing feed", "feed", feed.Name) wg.Add(1) go func() { @@ -49,7 +50,7 @@ func Run(configPath string) { wg.Wait() } -func ProcessFeed(feed FeedCfg, scheduler Scheduler, dbDir string, tgram telegram.TelegramSender) { +func ProcessFeed(feed *FeedCfg, scheduler Scheduler, dbDir string, tgram telegram.TelegramSender) { sd, err := scheduler.ShouldDownload(feed.Name, feed.Cron) if err != nil { log.Error("shouldDownload failed", "feed", feed.Name, "err", err)