Skip to content

Commit

Permalink
feat(api): add retry mechanism for question answering
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W committed Nov 28, 2023
1 parent 8693297 commit 7fba63d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/ask_astro/services/questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 7fba63d

Please sign in to comment.