Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

fix: Delete retry to DB, not stable enough

Clémence Lesnéc2bfca94ab0b
diff --git a/persistence/ai_search.py b/persistence/ai_search.py
index f259e55..96674c7 100644
--- a/persistence/ai_search.py
+++ b/persistence/ai_search.py
@@ -9,7 +9,6 @@ from helpers.logging import build_logger
from models.training import TrainingModel
from persistence.isearch import ISearch
from pydantic import ValidationError
-from tenacity import retry, stop_after_attempt, wait_random_exponential
from typing import AsyncGenerator, List, Optional
@@ -64,9 +63,6 @@ class AiSearchSearch(ISearch):
_logger.error(f"Error connecting to AI Search, {e.message}")
return trainings or None
- @retry(
- stop=stop_after_attempt(3), wait=wait_random_exponential(multiplier=0.5, max=30)
- )
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[SearchClient, None]:
async with SearchClient(
diff --git a/persistence/cosmos.py b/persistence/cosmos.py
index ad6a804..bfb7f35 100644
--- a/persistence/cosmos.py
+++ b/persistence/cosmos.py
@@ -10,7 +10,6 @@ from helpers.logging import build_logger
from models.call import CallModel
from persistence.istore import IStore
from pydantic import ValidationError
-from tenacity import retry, stop_after_attempt, wait_random_exponential
from typing import AsyncGenerator, List, Optional
from uuid import UUID
@@ -113,9 +112,6 @@ class CosmosStore(IStore):
_logger.warn(f"Error parsing call, {e.message}")
return calls or None
- @retry(
- stop=stop_after_attempt(3), wait=wait_random_exponential(multiplier=0.5, max=30)
- )
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[ContainerProxy, None]:
yield self._db
diff --git a/persistence/sqlite.py b/persistence/sqlite.py
index 65b1d69..9db662d 100644
--- a/persistence/sqlite.py
+++ b/persistence/sqlite.py
@@ -7,7 +7,6 @@ from helpers.logging import build_logger
from models.call import CallModel
from persistence.istore import IStore
from pydantic import ValidationError
-from tenacity import retry, stop_after_attempt, wait_random_exponential
from typing import AsyncGenerator, List, Optional
from uuid import UUID
import json
@@ -114,9 +113,6 @@ class SqliteStore(IStore):
# Write changes to disk
await db.commit()
- @retry(
- stop=stop_after_attempt(3), wait=wait_random_exponential(multiplier=0.5, max=30)
- )
@asynccontextmanager
async def _use_db(self) -> AsyncGenerator[SQLiteConnection, None]:
# Create folder