From 1ee1c3c35d12aa4e392ae664ef929ef5cae24fd3 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 10 Jul 2018 19:26:06 -0400 Subject: [PATCH] safer document deletion --- search/search.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/search/search.py b/search/search.py index ba3da20..3d0a33d 100644 --- a/search/search.py +++ b/search/search.py @@ -1,4 +1,5 @@ import elasticsearch +import time from elasticsearch import helpers import os import ujson @@ -107,6 +108,9 @@ class ElasticSearchEngine(SearchEngine): }, index=self.index_name, request_timeout=40) except elasticsearch.exceptions.ConflictError: print("Error: multiple delete tasks at the same time") + except elasticsearch.exceptions.ConnectionTimeout: + print("Timeout during delete!") + time.sleep(30) def import_json(self, in_lines, website_id: int):