Add Wildberries product fetching and rate limiting functionality

This commit is contained in:
2025-07-04 13:30:50 +03:00
parent b48421e653
commit dc097c6fc8
67 changed files with 81355 additions and 110 deletions

View File

@@ -5,7 +5,7 @@ import (
proto "sipro-mps/api/generated/v1/ozon/products"
)
//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen -g 'ignoreUnexported yes' .
//go:generate go run github.com/jmattheis/goverter/cmd/goverter gen -global "ignoreUnexported yes" .
// goverter:converter
// goverter:extend Int632ToInt64

View File

@@ -5,9 +5,8 @@ package generated
import (
ozon "git.denco.store/fakz9/ozon-api-client/ozon"
products "sipro-mps/api/generated/v1/ozon/products"
ozon "git.denco.store/fakz9/ozon-api-client/ozon"
mapping "sipro-mps/internal/ozon/products/mapping"
)
type ConverterImpl struct{}

View File

@@ -85,7 +85,7 @@ func (a *apiRepository) GetAllProducts(ctx context.Context, marketplaceId int) (
if err != nil {
return nil, err
}
items := []OzonProduct{}
var items []OzonProduct
productIdsChan := make(chan []int64)
producsChan := make(chan []OzonProduct)
errChan := make(chan error)

View File

@@ -50,7 +50,7 @@ func (t *RateLimitTransport) RoundTrip(req *http.Request) (*http.Response, error
waitTime, err := rateLimiterScript.Exec(ctx, *redis.Client, []string{clientId}, []string{
fmt.Sprintf("%d", now),
fmt.Sprintf("%d", int64(windowSize)),
fmt.Sprintf("%d", 50),
fmt.Sprintf("%d", rps),
}).ToInt64()
if err != nil {
return nil, fmt.Errorf("failed to execute rate limit script: %w", err)