fix(db): await AsyncConnection.execution_options in run_maintenance
execution_options() is a coroutine on AsyncConnection and must be awaited; the un-awaited call returned a coroutine, so exec_driver_sql() blew up with AttributeError and every table's VACUUM was skipped (Run-now reported 0/6). A prior change had wrongly dropped the await. Fix it and make the test mock execution_options async so this call shape is actually exercised. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -66,9 +66,10 @@ async def run_maintenance(tables: tuple[str, ...] | list[str] | None = None) ->
|
||||
results: list[dict] = []
|
||||
|
||||
async with engine.connect() as conn:
|
||||
# execution_options() is synchronous on AsyncConnection; it returns the
|
||||
# connection with AUTOCOMMIT set (VACUUM can't run in a transaction).
|
||||
autocommit = conn.execution_options(isolation_level="AUTOCOMMIT")
|
||||
# On AsyncConnection, execution_options() is a coroutine and MUST be
|
||||
# awaited (it returns the connection with AUTOCOMMIT set — VACUUM can't
|
||||
# run inside a transaction block).
|
||||
autocommit = await conn.execution_options(isolation_level="AUTOCOMMIT")
|
||||
for table in targets:
|
||||
t0 = time.monotonic()
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user