feat: add condition to store offers only if they meet 90% of requested count
This commit is contained in:
		@@ -121,6 +121,10 @@ func (r *apiRepository) GetProducts(ctx context.Context, marketplaceID int, req
 | 
				
			|||||||
	// all offers
 | 
						// all offers
 | 
				
			||||||
	var allOffers []*pb.GetProductsResponse_Offer
 | 
						var allOffers []*pb.GetProductsResponse_Offer
 | 
				
			||||||
	defer func() {
 | 
						defer func() {
 | 
				
			||||||
 | 
							// store only if offers is 90% or more then requested
 | 
				
			||||||
 | 
							if len(allOffers) < int(float64(len(req.OfferIds))*0.9) {
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if len(allOffers) == 0 {
 | 
							if len(allOffers) == 0 {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user