allow to skip item by created
This commit is contained in:
@ -325,7 +325,18 @@ func (c client) GetProductInfo(ctx context.Context, cart int64) (pi entity.Goods
|
||||
})
|
||||
})
|
||||
|
||||
err = collector.Visit("https://eway.elevel.ru/product/" + strconv.Itoa(int(cart)) + "/")
|
||||
for i := 0; i < 3; i++ {
|
||||
err = collector.Visit("https://eway.elevel.ru/product/" + strconv.Itoa(int(cart)) + "/")
|
||||
if err != nil {
|
||||
c.log.Warn().Err(err).Msg("unable to visit site, retrying...")
|
||||
select {
|
||||
case <-time.After(time.Second * 2):
|
||||
continue
|
||||
case <-ctx.Done():
|
||||
return pi, ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return pi, fmt.Errorf("visiting site: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user