fix(tests): isolate db state and stabilize voice runtime suite
This commit is contained in:
@@ -599,8 +599,19 @@ def init_sql_schema() -> None:
|
||||
if schema_management_mode() == "migrations":
|
||||
validate_schema_migrations_applied()
|
||||
elif not _BASE_SCHEMA_INITIALIZED:
|
||||
Base.metadata.create_all(bind=engine)
|
||||
_BASE_SCHEMA_INITIALIZED = True
|
||||
for attempt in range(5):
|
||||
try:
|
||||
Base.metadata.create_all(bind=engine)
|
||||
_BASE_SCHEMA_INITIALIZED = True
|
||||
break
|
||||
except OperationalError as exc:
|
||||
message = str(exc).lower()
|
||||
if "already exists" in message:
|
||||
_BASE_SCHEMA_INITIALIZED = True
|
||||
break
|
||||
if "database is locked" not in message or attempt >= 4:
|
||||
raise
|
||||
time.sleep(0.25 * (attempt + 1))
|
||||
for attempt in range(5):
|
||||
try:
|
||||
_apply_runtime_schema_compatibility()
|
||||
|
||||
Reference in New Issue
Block a user