allow to skip item by created

This commit is contained in:
Aleksandr Trushkin
2024-02-04 22:13:39 +03:00
parent 15d4cdb047
commit 3c68c0b2fd
7 changed files with 51 additions and 3 deletions

View File

@ -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)
}