aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.go b/main.go
index ba749c5..5a2bd3e 100644
--- a/main.go
+++ b/main.go
@@ -70,8 +70,7 @@ func main() {
var wg sync.WaitGroup
wg.Add(1)
go describeFeed(feed, &wg)
- wg.Add(len(feed.Items))
- go describeEpisodes(feed, &wg)
+ describeEpisodes(feed)
feed.Created = time.Now()
wg.Wait()
@@ -161,10 +160,13 @@ func describeFeed(feed *feeds.Feed, wg *sync.WaitGroup) {
feed.Description = string(re.ReplaceAll(programAbout, []byte(``)))
}
-func describeEpisodes(feed *feeds.Feed, wg *sync.WaitGroup) {
+func describeEpisodes(feed *feeds.Feed) {
+ var wg sync.WaitGroup
for _, item := range feed.Items {
- go describeEpisode(item, wg)
+ wg.Add(1)
+ go describeEpisode(item, &wg)
}
+ wg.Wait()
}
func describeEpisode(item *feeds.Item, wg *sync.WaitGroup) {