Refactor marketplace product fetching and caching logic; update environment configuration for Redis and PostgreSQL
This commit is contained in:
		@@ -15,6 +15,7 @@ import (
 | 
			
		||||
	"sipro-mps/internal/wb"
 | 
			
		||||
	"sipro-mps/internal/wb/products/mapping/generated"
 | 
			
		||||
	wbapi "sipro-mps/pkg/api/wb/client"
 | 
			
		||||
	"sipro-mps/pkg/utils"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
@@ -31,7 +32,7 @@ func (a apiRepository) ParseMarketplace(ctx context.Context, marketplaceId int)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
	}
 | 
			
		||||
	_, claims, err := wb.DecodeWildberriesJwt(marketplaceByID.AuthDataJson)
 | 
			
		||||
	_, claims, err := utils.DecodeWildberriesJwt(marketplaceByID.AuthDataJson)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, "", err
 | 
			
		||||
	}
 | 
			
		||||
@@ -113,7 +114,7 @@ func (a apiRepository) StreamAllProductsCache(ctx context.Context, marketplaceId
 | 
			
		||||
			errChan <- fmt.Errorf("unmarshalling products from cache: %w", err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		task, err := types.NewFetchProductsTask(marketplaceId)
 | 
			
		||||
		task, err := types.NewFetchProductsTask(types.TypeWbFetchProducts, marketplaceId)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			errChan <- fmt.Errorf("creating fetch products task: %w", err)
 | 
			
		||||
			return
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user