Реализация на отдельных двух машинах с протестированным взаимодействием по проверке сообщений
This commit is contained in:
@@ -254,11 +254,23 @@ class SafetyClient:
|
||||
async def ready(self) -> bool:
|
||||
try:
|
||||
response = await self.http.get(
|
||||
f"{str(self.settings.message_safety_url).rstrip('/')}/health/ready",
|
||||
f"{str(self.settings.message_safety_url).rstrip('/')}/internal/safety/status",
|
||||
timeout=2,
|
||||
)
|
||||
return response.status_code == 200
|
||||
except httpx.HTTPError:
|
||||
if response.status_code != 200:
|
||||
return False
|
||||
body = response.json()
|
||||
capabilities = body.get("capabilities", {})
|
||||
return (
|
||||
body.get("status") in {"ok", "degraded"}
|
||||
and body.get("processing_mode") == "standard"
|
||||
and type(body.get("config_version")) is int
|
||||
and all(
|
||||
capabilities.get(name) == "ready"
|
||||
for name in ("text", "links", "files", "worker")
|
||||
)
|
||||
)
|
||||
except (httpx.HTTPError, AttributeError, ValueError):
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user