From 0c1bee31f49df328af6da210b0b0630961f45528 Mon Sep 17 00:00:00 2001 From: unexpected Date: Thu, 9 Oct 2025 18:28:30 +0000 Subject: [PATCH] keys stabilize --- app/core/background/convert_v3_service.py | 7 ++++++- app/core/network/key_client.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/core/background/convert_v3_service.py b/app/core/background/convert_v3_service.py index f950ba7..42f28a1 100644 --- a/app/core/background/convert_v3_service.py +++ b/app/core/background/convert_v3_service.py @@ -376,7 +376,12 @@ async def _pick_pending(limit: int) -> List[Tuple[EncryptedContent, PlainStaging if not staging: peers = (await session.execute(select(KnownNode))).scalars().all() for peer in peers: - base_url = f"http://{peer.ip}:{peer.port}" + meta = peer.meta or {} + public_host = meta.get('public_host') + if not public_host: + last_resp = (meta.get('last_response') or {}).get('node', {}) if isinstance(meta, dict) else {} + public_host = last_resp.get('public_host') + base_url = public_host or f"http://{peer.ip}:{peer.port}" dek = await request_key_from_peer(base_url, ec.encrypted_cid) if not dek: continue diff --git a/app/core/network/key_client.py b/app/core/network/key_client.py index 04fc781..2e03d04 100644 --- a/app/core/network/key_client.py +++ b/app/core/network/key_client.py @@ -1,6 +1,7 @@ from __future__ import annotations import base64 +import json from typing import Optional import httpx