fix: enforce durable migration ownership and readiness
This commit is contained in:
parent
14befd0b50
commit
826874a47e
5 changed files with 52 additions and 0 deletions
|
|
@ -22,6 +22,8 @@ from hub_core.runtime.models import (
|
|||
RegistryRegistration,
|
||||
)
|
||||
from hub_core.runtime.tables import (
|
||||
compat_api_keys,
|
||||
compat_hubs,
|
||||
runtime_audit_ledger,
|
||||
runtime_interaction_events,
|
||||
runtime_messages,
|
||||
|
|
@ -47,6 +49,13 @@ class PostgresPortStore:
|
|||
try:
|
||||
async with self.engine.connect() as connection:
|
||||
await connection.execute(sa.text("SELECT 1"))
|
||||
# A live connection alone can hide a mis-granted runtime lease.
|
||||
# Exercise the durable port, compatibility, and authorization
|
||||
# tables that protected traffic actually depends on.
|
||||
for table in (runtime_audit_ledger, compat_hubs, compat_api_keys):
|
||||
await connection.execute(
|
||||
sa.select(sa.literal(1)).select_from(table).limit(1)
|
||||
)
|
||||
except Exception:
|
||||
return {"database": "unavailable"}
|
||||
return {"database": "ok"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue