Add basic retries to Vespa insert calls

This commit is contained in:
Weves
2023-10-26 14:19:25 -07:00
committed by Chris Weaver
parent dcbb7b85d9
commit c9edc2711c

View File

@@ -13,6 +13,7 @@ from typing import cast
import requests import requests
from requests import HTTPError from requests import HTTPError
from requests import Response from requests import Response
from retry import retry
from danswer.chunking.models import DocMetadataAwareIndexChunk from danswer.chunking.models import DocMetadataAwareIndexChunk
from danswer.chunking.models import InferenceChunk from danswer.chunking.models import InferenceChunk
@@ -147,6 +148,7 @@ def _delete_vespa_doc_chunks(document_id: str) -> bool:
return not any(failures) return not any(failures)
@retry(tries=3, delay=1, backoff=2)
def _index_vespa_chunk( def _index_vespa_chunk(
chunk: DocMetadataAwareIndexChunk, already_existing_documents: set[str] chunk: DocMetadataAwareIndexChunk, already_existing_documents: set[str]
) -> bool: ) -> bool: