fix(proxy): support Python 3.12 health imports

This commit is contained in:
Mark Philipp 2026-08-24 15:10:33 -07:00
parent d0543ca35b
commit 9809b60c76
3 changed files with 4 additions and 12 deletions

View file

@ -130,10 +130,7 @@ class UserAPIKeyAuthExceptionHandler:
database_unavailable: Final = (
PrismaDBExceptionHandler.is_database_connection_error(e) or configured_database_without_client
)
if (
PrismaDBExceptionHandler.should_allow_request_on_db_unavailable()
and database_unavailable
):
if PrismaDBExceptionHandler.should_allow_request_on_db_unavailable() and database_unavailable:
# log this as a DB failure on prometheus
proxy_logging_obj.service_logging_obj.service_failure_hook(
service=ServiceTypes.DB,

View file

@ -8,7 +8,7 @@ import time
import traceback
from collections.abc import Iterable, Mapping
from datetime import datetime, timedelta
from typing import Any, Final, Literal, NotRequired, ReadOnly, TypedDict, cast
from typing import Any, Final, Literal, NotRequired, TypedDict, cast
import fastapi
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status
@ -1765,10 +1765,7 @@ async def _resolve_public_readiness_db(response: Response) -> str:
return "disconnected" if initial_recovery_pending else "Not connected"
db_health_status: Final = await _db_health_readiness_check()
if (
db_health_status["status"] != "connected"
and _readiness_can_fail_open(db_health_status) is False
):
if db_health_status["status"] != "connected" and _readiness_can_fail_open(db_health_status) is False:
response.status_code = status.HTTP_503_SERVICE_UNAVAILABLE
return db_health_status["status"]

View file

@ -10137,9 +10137,7 @@ class ProxyStartupEvent:
for attempt in range(3):
try:
result = await global_agent_registry.migrate_legacy_grant_ids(
table=object_permission_table(client)
)
result = await global_agent_registry.migrate_legacy_grant_ids(table=object_permission_table(client))
if result.rewritten:
verbose_proxy_logger.info(
"Rewrote %s object_permission rows from legacy config agent ids", result.rewritten