Skip to content
Snippets Groups Projects
Commit 3ec6b4845881 authored by Arthur Lutz's avatar Arthur Lutz
Browse files

[hooks] skip indexing if no connection to ES

parent c2966ba5d142
No related branches found
No related tags found
No related merge requests found
......@@ -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')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment