dynamic ES pagination pit for meta embed task

This commit is contained in:
Simon 2026-02-21 09:20:27 +07:00
parent c4ac6441bd
commit b9ce0259f9
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 4 additions and 1 deletions

View File

@ -149,6 +149,7 @@ class IndexPaginate:
- task: task object to send notification
- total: int, total items in index for progress message
- timeout: int, overwrite timeout in get request
- pit_keep_alive: int, overwrite pit valid
"""
DEFAULT_SIZE = 500
@ -169,7 +170,8 @@ class IndexPaginate:
def get_pit(self):
"""get pit for index"""
path = f"{self.index_name}/_pit?keep_alive=15m"
keep_alive = self.kwargs.get("pit_keep_alive", 15)
path = f"{self.index_name}/_pit?keep_alive={keep_alive}m"
response, _ = ElasticWrap(path).post()
self.pit_id = response["id"]

View File

@ -48,6 +48,7 @@ class MetadataEmbed:
callback=MetadataEmbedCallback,
task=self.task,
total=self._get_total(),
pit_keep_alive=1000,
)
_ = paginate.get_results()