feat: implement HashArray utility and refactor product key generation for Redis
This commit is contained in:
		@@ -53,7 +53,7 @@ func (p *FetchProductsProcessor) ProcessTask(ctx context.Context, task *asynq.Ta
 | 
			
		||||
	productsProto := lo.Map(productsRaw, func(item products.OzonProduct, _ int) *products.PbProduct {
 | 
			
		||||
		return converter.ToProto(&item)
 | 
			
		||||
	})
 | 
			
		||||
	redisKey := fmt.Sprintf("ozon:products:%s", identifier)
 | 
			
		||||
	redisKey := products.GetProductsKey(identifier)
 | 
			
		||||
	err = redis.WriteProtoMessage(ctx, redisKey, &pb.GetListOfProductsResponse{Products: productsProto})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		fmt.Printf("Failed to write products to Redis for marketplace %s: %v\n", identifier, err)
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ func (p *FetchProductsProcessor) ProcessTask(ctx context.Context, task *asynq.Ta
 | 
			
		||||
 | 
			
		||||
	defer cancel()
 | 
			
		||||
 | 
			
		||||
	redisKey := fmt.Sprintf("wb:products:%s", sellerId)
 | 
			
		||||
	redisKey := products.GetProductsKey(sellerId)
 | 
			
		||||
	productsRaw, err := repo.GetAllProducts(ctx, payload.MarketplaceId)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("failed to fetch products for marketplace %d: %w", payload.MarketplaceId, err)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user