diff --git a/api/ask_astro/services/questions.py b/api/ask_astro/services/questions.py index 04d6de10..38151686 100644 --- a/api/ask_astro/services/questions.py +++ b/api/ask_astro/services/questions.py @@ -5,6 +5,8 @@ import time from logging import getLogger +from tenacity import retry, stop_after_attempt, wait_exponential + from ask_astro.clients.firestore import firestore_client from ask_astro.config import FirestoreCollections from ask_astro.models.request import AskAstroRequest, Source @@ -23,6 +25,7 @@ async def _update_firestore_request(request: AskAstroRequest) -> None: ) +@retry(stop=stop_after_attempt(5), wait=wait_exponential(multiplier=1, max=10)) async def answer_question(request: AskAstroRequest) -> None: """ Performs the actual question answering logic and updates the request object.