chore: backoff als tuple, exception-chain via raise-from
This commit is contained in:
@@ -10,7 +10,7 @@ from app.config import get_settings
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
_BACKOFF_SECONDS = [1, 2, 4]
|
||||
_BACKOFF_SECONDS: tuple[int, ...] = (1, 2, 4)
|
||||
|
||||
|
||||
class EmbeddingError(Exception):
|
||||
@@ -47,7 +47,7 @@ async def _embed_one(text: str, model: str) -> list[float]:
|
||||
extra={"event": "embed_retry", "attempt": attempt + 1, "wait_s": wait, "error": str(exc)},
|
||||
)
|
||||
await asyncio.sleep(wait)
|
||||
raise EmbeddingError(f"embed failed after retries: {last_err}")
|
||||
raise EmbeddingError("embed failed after retries") from last_err
|
||||
|
||||
|
||||
async def embedding_dimension(model: str) -> int:
|
||||
|
||||
Reference in New Issue
Block a user