Added savepoint in site indexer
authorThierry Florac <thierry.florac@onf.fr>
Mon, 17 Sep 2018 16:14:56 +0200
changeset 80 f691b998d91d
parent 79 984645eb238c
child 81 6c2715230d09
Added savepoint in site indexer
src/pyams_content_es/site.py
--- a/src/pyams_content_es/site.py	Fri Jul 20 12:58:50 2018 +0200
+++ b/src/pyams_content_es/site.py	Mon Sep 17 16:14:56 2018 +0200
@@ -18,15 +18,13 @@
 
 # import interfaces
 from pyams_content_es.interfaces import IContentIndexerUtility, INDEXER_NAME, IDocumentIndexTarget
-from pyams_utils.interfaces.site import ISiteGenerations
-
 # import packages
 from pyams_content_es.utility import ContentIndexerUtility
 from pyams_utils.container import find_objects_providing
+from pyams_utils.interfaces.site import ISiteGenerations
 from pyams_utils.registry import utility_config, set_local_registry, query_utility
 from pyams_utils.site import check_required_utilities, site_factory
 
-
 REQUIRED_UTILITIES = ((IContentIndexerUtility, '', ContentIndexerUtility, INDEXER_NAME), )
 
 
@@ -58,6 +56,7 @@
                 for document in find_objects_providing(application, IDocumentIndexTarget):
                     print("Indexing: {0!r}".format(document))
                     es_client.index_object(document)
+                    transaction.savepoint()
         finally:
             set_local_registry(None)
         transaction.commit()