Files
agent/app/modules/shared/bootstrap.py
2026-02-25 14:47:19 +03:00

22 lines
638 B
Python

import time
from app.modules.shared.checkpointer import get_checkpointer
def bootstrap_database(rag_repository, chat_repository, agent_repository) -> None:
last_error: Exception | None = None
for attempt in range(1, 16):
try:
rag_repository.ensure_tables()
chat_repository.ensure_tables()
agent_repository.ensure_tables()
get_checkpointer()
return
except Exception as exc: # noqa: BLE001
last_error = exc
if attempt == 15:
break
time.sleep(1)
assert last_error is not None
raise last_error