issues, chat FPS; optimisations

This commit is contained in:
Dobromir Popov
2026-07-10 01:30:07 +03:00
parent 916f531e9d
commit f54ea100fb
17 changed files with 688 additions and 108 deletions

View File

@@ -112,6 +112,8 @@ class RelayHttpBridge:
self._connected = threading.Event()
self._executor: ThreadPoolExecutor | None = None
self._send_lock = threading.Lock()
self._decode_log_lock = threading.Lock()
self._decode_steps: dict[str, int] = {}
self._ws = None
@property
@@ -230,8 +232,21 @@ class RelayHttpBridge:
headers = payload.get("headers") if isinstance(payload.get("headers"), dict) else {}
binary_mode = binary_body is not None
session = str(headers.get("X-Meshnet-Session") or "")
cache_mode = headers.get("X-Meshnet-Cache")
req_suffix = f" request_id={request_id}" if request_id else ""
print(f" [node] relay {method} {path}{req_suffix}", flush=True)
if path == "/forward" and cache_mode == "decode" and session:
with self._decode_log_lock:
steps = self._decode_steps.get(session, 0) + 1
self._decode_steps[session] = steps
if steps == 1 or steps % 32 == 0:
print(
f" [node] relay {method} {path} session={session[:8]} steps={steps}{req_suffix}",
flush=True,
)
else:
session_suffix = f" session={session[:8]}" if session else ""
print(f" [node] relay {method} {path}{session_suffix}{req_suffix}", flush=True)
if binary_mode:
data = binary_body