mirror of
https://github.com/simon987/od-database.git
synced 2025-04-20 02:46:45 +00:00
safer document deletion
This commit is contained in:
parent
35b40f002d
commit
1ee1c3c35d
@ -1,4 +1,5 @@
|
|||||||
import elasticsearch
|
import elasticsearch
|
||||||
|
import time
|
||||||
from elasticsearch import helpers
|
from elasticsearch import helpers
|
||||||
import os
|
import os
|
||||||
import ujson
|
import ujson
|
||||||
@ -107,6 +108,9 @@ class ElasticSearchEngine(SearchEngine):
|
|||||||
}, index=self.index_name, request_timeout=40)
|
}, index=self.index_name, request_timeout=40)
|
||||||
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")
|
||||||
|
except elasticsearch.exceptions.ConnectionTimeout:
|
||||||
|
print("Timeout during delete!")
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
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