Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Change batch_size for task for updating product search document values (#9126)
Iga Karbowiakc5355706f4db
diff --git a/saleor/core/search_tasks.py b/saleor/core/search_tasks.pyindex 15f63e6b41..2ad3e9bdbf 100644--- a/saleor/core/search_tasks.py+++ b/saleor/core/search_tasks.py@@ -63,9 +63,12 @@ def set_order_search_document_values(total_count, updated_count):@app.taskdef set_product_search_document_values(total_count, updated_count):+ # set lower batch size as it was crashing for products with+ # lots of attributes because out of memory issues+ batch_size = 500qs = Product.objects.filter(search_document="").prefetch_related(*PRODUCT_FIELDS_TO_PREFETCH- )[:BATCH_SIZE]+ )[:batch_size]if not qs:task_logger.info("No products to update.")return