import asyncio import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from sqlalchemy import text from src.core.database import engine async def main(): for attempt in range(30): try: async with engine.connect() as connection: await connection.execute(text("SELECT 1")) await engine.dispose() return except Exception: if attempt == 29: raise await asyncio.sleep(1) if __name__ == "__main__": asyncio.run(main())