mirror of
https://github.com/simon987/od-database.git
synced 2025-04-20 02:46:45 +00:00
retry if deleting docs fail
This commit is contained in:
parent
f452d0f8b2
commit
2f1b0c96f1
@ -95,6 +95,7 @@ class ElasticSearchEngine(SearchEngine):
|
||||
|
||||
def delete_docs(self, website_id):
|
||||
|
||||
while True:
|
||||
try:
|
||||
print("Deleting docs of " + str(website_id))
|
||||
self.es.delete_by_query(body={
|
||||
@ -106,11 +107,13 @@ class ElasticSearchEngine(SearchEngine):
|
||||
}
|
||||
}
|
||||
}, index=self.index_name, request_timeout=200)
|
||||
break
|
||||
except elasticsearch.exceptions.ConflictError:
|
||||
print("Error: multiple delete tasks at the same time")
|
||||
print("Error: multiple delete tasks at the same time, retrying")
|
||||
time.sleep(10)
|
||||
except Exception:
|
||||
print("Timeout during delete!")
|
||||
time.sleep(30)
|
||||
print("Timeout during delete! Retrying")
|
||||
time.sleep(10)
|
||||
|
||||
def import_json(self, in_lines, website_id: int):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user