mirror of
https://github.com/simon987/od-database.git
synced 2025-04-20 10:56:47 +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):
|
def delete_docs(self, website_id):
|
||||||
|
|
||||||
|
while True:
|
||||||
try:
|
try:
|
||||||
print("Deleting docs of " + str(website_id))
|
print("Deleting docs of " + str(website_id))
|
||||||
self.es.delete_by_query(body={
|
self.es.delete_by_query(body={
|
||||||
@ -106,11 +107,13 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, index=self.index_name, request_timeout=200)
|
}, index=self.index_name, request_timeout=200)
|
||||||
|
break
|
||||||
except elasticsearch.exceptions.ConflictError:
|
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:
|
except Exception:
|
||||||
print("Timeout during delete!")
|
print("Timeout during delete! Retrying")
|
||||||
time.sleep(30)
|
time.sleep(10)
|
||||||
|
|
||||||
def import_json(self, in_lines, website_id: int):
|
def import_json(self, in_lines, website_id: int):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user