Skip to content

Commit

Permalink
check torrs empty output
Browse files Browse the repository at this point in the history
  • Loading branch information
evfedoto committed Aug 25, 2023
1 parent b676f5b commit f625de5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ func (p *TrackersPipeline) RunTrackersSearchPipilene(isMovie string) *TrackersPi
allTorrents := pipeline.Merge(ctx, torrentsResults1, torrentsResults2)
allErrors := pipeline.Merge(ctx, rutorErrors1, rutorErrors2)

log.Println("ALL len: ", len(allTorrents))

ts, err := torrents.MergeTorrentChannlesToSlice(ctx, cancel, allTorrents, allErrors)
log.Println("TS length before: ", len(ts))
ts = torrents.RemoveDuplicatesInPlace(ts)
Expand Down
5 changes: 5 additions & 0 deletions internal/torrents/torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func MergeTorrentChannlesToSlice(ctx context.Context, cancelFunc context.CancelF
case res, ok := <-values:
if ok {
torrents = append(torrents, res...)
log.Print("Appending ", len(res), " torrents to slice. Total: ", len(torrents), " torrents")
if len(res) == 0 {
log.Print("Empty slice received")
return torrents, nil
}
} else {
log.Print("done")
return torrents, nil
Expand Down

0 comments on commit f625de5

Please sign in to comment.