threads
This commit is contained in:
@ -34,7 +34,7 @@ var platiCommand = &cli.Command{
|
||||
// printNames(categories)
|
||||
|
||||
wg, _ := errgroup.WithContext(ctx)
|
||||
wg.SetLimit(30)
|
||||
wg.SetLimit(10)
|
||||
|
||||
for i, c := range categories {
|
||||
l := i
|
||||
@ -48,6 +48,8 @@ var platiCommand = &cli.Command{
|
||||
if len(goods) == 0 {
|
||||
return nil
|
||||
}
|
||||
log.Printf("inserting %d goods to DB", len(goods))
|
||||
|
||||
gormGoods := convertGoodsToGorm(cat, goods)
|
||||
if err := db.Create(gormGoods).Error; err != nil {
|
||||
return fmt.Errorf("db Create: %w", err)
|
||||
|
@ -34,6 +34,10 @@ func (c *Client) GetBlockGoodsCategory(ctx context.Context, idC int, idR int, so
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("status code: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
goods, err := parseGoodsCategory(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parse goods category: %w", err)
|
||||
|
Reference in New Issue
Block a user