# HG changeset patch # User David Douard <david.douard@logilab.fr> # Date 1493882661 -7200 # Thu May 04 09:24:21 2017 +0200 # Node ID 1c4e7b35e611717b8167756ac269d365500c8597 # Parent 6bd462ae5a6c28925a07f17f3fc4f92a5dc5658b [ccplugin] do not crash if an entity failed to serialize otherwise the import just hand forever. diff --git a/cubicweb_elasticsearch/ccplugin.py b/cubicweb_elasticsearch/ccplugin.py --- a/cubicweb_elasticsearch/ccplugin.py +++ b/cubicweb_elasticsearch/ccplugin.py @@ -102,8 +102,14 @@ cnx.debug(u'RQL: {}'.format(rql)) for entity in rset.entities(): - serializer = entity.cw_adapt_to('IFullTextIndexSerializable') - json = serializer.serialize() + try: + serializer = entity.cw_adapt_to('IFullTextIndexSerializable') + json = serializer.serialize() + except Exception as e: + cnx.error('[{}] Failed to serialize entity {} ({})'.format( + index_name, entity.eid, etype)) + continue + if not dry_run and json: # Entities with # fulltext_containers relations return their container