Skip to content

Commit

Permalink
fix: Prevent misinterpreting alembic migration errors as event loop e…
Browse files Browse the repository at this point in the history
…rrors (#2879)

Backported-from: main (24.09)
Backported-to: 24.03
Backport-of: 2879
  • Loading branch information
achimnol committed Sep 30, 2024
1 parent 3a89a1c commit c6aeb3c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ai/backend/manager/models/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ async def run_migrations_online():
if context.is_offline_mode():
run_migrations_offline()
else:
run_standalone = False
try:
loop = asyncio.get_running_loop()
loop.run_until_complete(run_migrations_online())
except RuntimeError:
run_standalone = True
if run_standalone:
asyncio.run(run_migrations_online())

0 comments on commit c6aeb3c

Please sign in to comment.