feat: refactor product attributes caching logic and add HashArray utility function

This commit is contained in:
2025-08-17 11:37:15 +03:00
parent 593fbc88fa
commit e35d44dacb
3 changed files with 76 additions and 24 deletions

View File

@@ -95,7 +95,8 @@ func fetchProducts(
}
func (a apiRepository) StreamAllProductsCache(ctx context.Context, marketplaceId int, resultChan chan<- []pb.Product, errChan chan<- error) {
// DO NOT close channels here - WithCache will handle it (caller/creator owns them)
defer close(resultChan)
defer close(errChan)
mp, err := a.marketplaceRepository.GetMarketplaceByID(ctx, marketplaceId)
if err != nil {
errChan <- fmt.Errorf("getting marketplace by ID: %w", err)