fix(workbench): configure psycopg snapshot transaction
Open the psycopg transaction without unsupported SQLAlchemy-style options, then set the PostgreSQL isolation and read-only characteristics before the first query. Cover the exact snapshot endpoint path with a regression test.
This commit is contained in:
@@ -44,7 +44,10 @@ async def workbench_sync_snapshot(
|
||||
ctx: ProjectContext = Depends(require_permission(OPERATIONAL_TASK_VIEW)),
|
||||
conn: AsyncConnection = Depends(get_project_pg_connection),
|
||||
):
|
||||
async with conn.transaction(isolation_level="repeatable read", read_only=True):
|
||||
async with conn.transaction():
|
||||
await conn.execute(
|
||||
"SET TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY"
|
||||
)
|
||||
cursor = await WorkbenchEventRepository(conn, ctx.project_id).current_cursor()
|
||||
runtime = await workbench_runtime(ctx=ctx, conn=conn)
|
||||
tasks, _ = await _service(ctx, conn).list(
|
||||
|
||||
Reference in New Issue
Block a user