因errgroup不支持重用,故调整为每次执行时新起
This commit is contained in:
parent
a007d4a430
commit
2d610975e8
@ -21,7 +21,6 @@ type Crawler struct {
|
||||
avPath string
|
||||
outputPath string
|
||||
config *viper.Viper
|
||||
g errgroup.Group
|
||||
}
|
||||
|
||||
func NewCrawler(avPath, outputPath string) *Crawler {
|
||||
@ -220,8 +219,9 @@ func (c *Crawler) Handle() error {
|
||||
return err
|
||||
}
|
||||
|
||||
var g errgroup.Group
|
||||
for _, cover := range coverList {
|
||||
c.g.Go(func() error {
|
||||
g.Go(func() error {
|
||||
if err := c.fetchCoverImg(cover); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -230,5 +230,5 @@ func (c *Crawler) Handle() error {
|
||||
})
|
||||
}
|
||||
|
||||
return c.g.Wait()
|
||||
return g.Wait()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user