# HG changeset patch # User Arthur Lutz <arthur.lutz@logilab.fr> # Date 1474031997 -7200 # Fri Sep 16 15:19:57 2016 +0200 # Node ID 3ec6b48458813f6d086ba77406f8d8b07d82b791 # Parent c2966ba5d1425eaf76f7b924679bfa82fd850991 [hooks] skip indexing if no connection to ES diff --git a/hooks.py b/hooks.py --- a/hooks.py +++ b/hooks.py @@ -54,6 +54,9 @@ def precommit_event(self): indexer = self.cnx.vreg['es'].select('indexer', self.cnx) es = indexer.get_connection() + if es is None: + log.info('no connection to ES (not configured) skip ES indexing') + return for entity in self.get_data(): rql = fulltext_indexable_rql(entity.cw_etype, entity._cw.vreg.schema, @@ -74,4 +77,3 @@ es.index(**kwargs) except (ConnectionError, ProtocolError): log.debug('Failed to index in hook, could not connect to ES') -