Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(patch): skip not responding arbitrary servers (M2-6879) #1411

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import asyncio
import os
import uuid

from rich import print
from sqlalchemy import func, select
from sqlalchemy.ext.asyncio import AsyncSession
from sqlalchemy.orm import Query
Expand Down Expand Up @@ -130,17 +132,19 @@ async def main(session: AsyncSession, *args, **kwargs):
print(f"Workspace#{i + 1} DB already processed, skip...")
continue
processed.add(arb_uri)
session_maker = session_manager.get_session(arb_uri)
async with session_maker() as arb_session:
try:
await find_and_create_missing_roles_arbitrary(session, arb_session, workspace.user_id)
await arb_session.commit()
print(f"Processing workspace#{i + 1} {workspace.id} " f"finished")
except Exception:
await arb_session.rollback()
print(f"[bold red]Workspace#{i + 1} {workspace.id} " f"processing error[/bold red]")
raise

try:
session_maker = session_manager.get_session(arb_uri)
async with session_maker() as arb_session:
try:
await find_and_create_missing_roles_arbitrary(session, arb_session, workspace.user_id)
await arb_session.commit()
print(f"Processing workspace#{i + 1} {workspace.id} " f"finished")
except Exception:
await arb_session.rollback()
print(f"[bold red]Error: Workspace#{i + 1} {workspace.id} processing error[/bold red]")
raise
except asyncio.TimeoutError:
print(f"[bold red]Error: Workspace#{i + 1} {workspace.id} Timeout error, skipping...[/bold red]")
except Exception as ex:
await session.rollback()
raise ex
Loading