add timeout overwrite in es get, extend in zip backups

This commit is contained in:
Simon 2026-01-30 17:43:03 +07:00
parent d7ba4bc924
commit 9badd3b073
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 8 additions and 2 deletions

View File

@ -21,7 +21,7 @@ class ElasticBackup:
"""dump index to nd-json files for later bulk import"""
INDEX_SIZE_CONF = {
"comment": 200,
"comment": 100,
"subtitle": 10000,
}
CACHE_DIR = EnvironmentSettings.CACHE_DIR
@ -64,6 +64,7 @@ class ElasticBackup:
"callback": BackupCallback,
"task": self.task,
"total": self._get_total(index_name),
"timeout": 30,
}
if size_overwrite := self.INDEX_SIZE_CONF.get(index_name):

View File

@ -148,6 +148,7 @@ class IndexPaginate:
- callback: obj, Class implementing run method callback for every loop
- task: task object to send notification
- total: int, total items in index for progress message
- timeout: int, overwrite timeout in get request
"""
DEFAULT_SIZE = 500
@ -191,7 +192,11 @@ class IndexPaginate:
all_results = []
counter = 0
while True:
response, _ = ElasticWrap("_search").get(data=self.data)
get_kwargs = {"data": self.data}
if timeout_overwrite := self.kwargs.get("timeout"):
get_kwargs.update({"timeout": timeout_overwrite})
response, _ = ElasticWrap("_search").get(**get_kwargs)
all_hits = response["hits"]["hits"]
if not all_hits:
break