diff --git a/oscar_elasticsearch/search/api/category.py b/oscar_elasticsearch/search/api/category.py index 9700ddf..11e90b6 100644 --- a/oscar_elasticsearch/search/api/category.py +++ b/oscar_elasticsearch/search/api/category.py @@ -1,8 +1,5 @@ from odin.codecs import dict_codec -from django.db import transaction -from django.db.models import QuerySet - from oscar.core.loading import get_class, get_model # this index name is retrived with get_class because of i18n but it might be removed later @@ -38,16 +35,9 @@ def make_documents(self, objects): "search.mappings.categories", "CategoryElasticSearchMapping" ) - # the transaction and the select_for_update are candidates for removal! - with transaction.atomic(): - if isinstance(objects, QuerySet): - objects = objects.select_for_update() - - category_resources = catalogue.CategoryToResource.apply(objects) - category_document_resources = CategoryElasticSearchMapping.apply( - category_resources - ) + category_resources = catalogue.CategoryToResource.apply(objects) + category_document_resources = CategoryElasticSearchMapping.apply( + category_resources + ) - return dict_codec.dump( - category_document_resources, include_type_field=False - ) + return dict_codec.dump(category_document_resources, include_type_field=False) diff --git a/oscar_elasticsearch/search/api/product.py b/oscar_elasticsearch/search/api/product.py index 9725e89..c1b41f4 100644 --- a/oscar_elasticsearch/search/api/product.py +++ b/oscar_elasticsearch/search/api/product.py @@ -1,6 +1,5 @@ from odin.codecs import dict_codec -from django.db import transaction from django.db.models import QuerySet from oscar.core.loading import get_class, get_model, get_classes @@ -57,13 +56,9 @@ def make_documents(self, objects): "search.mappings.products", "ProductElasticSearchMapping" ) - # the transaction and the select_for_update are candidates for removal! - with transaction.atomic(): - objects = objects.select_for_update() - - product_resources = catalogue.product_queryset_to_resources(objects) - product_document_resources = ProductElasticSearchMapping.apply( - product_resources - ) + product_resources = catalogue.product_queryset_to_resources(objects) + product_document_resources = ProductElasticSearchMapping.apply( + product_resources + ) - return dict_codec.dump(product_document_resources, include_type_field=False) + return dict_codec.dump(product_document_resources, include_type_field=False)