Merge "db: Close connection on early return"

This commit is contained in:
Zuul 2022-04-23 02:50:13 +00:00 committed by Gerrit Code Review
commit 1ff89a09d4
1 changed files with 3 additions and 1 deletions

View File

@ -4362,9 +4362,11 @@ def _archive_deleted_rows_for_table(
deleted_instance_uuids = []
try:
shadow_table = schema.Table(
shadow_tablename, metadata, autoload_with=conn)
shadow_tablename, metadata, autoload_with=conn,
)
except sqla_exc.NoSuchTableError:
# No corresponding shadow table; skip it.
conn.close()
return rows_archived, deleted_instance_uuids, {}
# TODO(stephenfin): Drop this when we drop the table