Skip to content

Commit

Permalink
fix(patch): skip not responding arbitrary servers for answer update p…
Browse files Browse the repository at this point in the history
…atch (M2-7052) (#1414)
  • Loading branch information
vshvechko authored Jun 17, 2024
1 parent e975167 commit bf63307
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/apps/shared/commands/patches/m2_4611_add_answer_subjects.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import uuid

from rich import print
Expand Down Expand Up @@ -39,13 +40,16 @@ async def main(
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 update_answers(arb_session)
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 update_answers(arb_session)
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]")

0 comments on commit bf63307

Please sign in to comment.