mirror of
https://github.com/simon987/od-database.git
synced 2025-04-19 10:26:44 +00:00
error handling for delete
This commit is contained in:
parent
254d6ea44e
commit
750940d148
@ -114,6 +114,7 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
|
|
||||||
def delete_docs(self, website_id):
|
def delete_docs(self, website_id):
|
||||||
|
|
||||||
|
while True:
|
||||||
try:
|
try:
|
||||||
logger.debug("Deleting docs of " + str(website_id))
|
logger.debug("Deleting docs of " + str(website_id))
|
||||||
|
|
||||||
@ -121,7 +122,7 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
"query": {
|
"query": {
|
||||||
"term": {"website_id": website_id}
|
"term": {"website_id": website_id}
|
||||||
}
|
}
|
||||||
}, scroll="1m", client=self.es, index=self.index_name, request_timeout=60)
|
}, scroll="1m", client=self.es, index=self.index_name, request_timeout=120)
|
||||||
|
|
||||||
buf = []
|
buf = []
|
||||||
counter = 0
|
counter = 0
|
||||||
@ -135,9 +136,11 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
counter = 0
|
counter = 0
|
||||||
if counter > 0:
|
if counter > 0:
|
||||||
self._delete(buf)
|
self._delete(buf)
|
||||||
|
break
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(str(e))
|
logger.error("During delete: " + str(e))
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
logger.debug("Done deleting for " + str(website_id))
|
logger.debug("Done deleting for " + str(website_id))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user