Первый коммит
This commit is contained in:
21
app/modules/shared/bootstrap.py
Normal file
21
app/modules/shared/bootstrap.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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
|
||||
Reference in New Issue
Block a user