Исправление бесконечного рендер-цикла SearchView и поиск по публичному ключу

This commit is contained in:
2026-03-08 05:18:15 +05:00
parent e26d94b268
commit 685029b623
25 changed files with 555 additions and 883 deletions

View File

@@ -328,14 +328,13 @@ final class ProtocolManager: @unchecked Sendable {
private func startHeartbeat(interval: Int) {
heartbeatTask?.cancel()
let intervalMs = UInt64(interval) * 1_000_000_000 / 3
// Match Android: intervalMs = (intervalSeconds * 1000L) / 2
let intervalNs = UInt64(interval) * 1_000_000_000 / 2
heartbeatTask = Task {
// Send first heartbeat immediately
client.sendText("heartbeat")
// Match Android: delay first, then send (no immediate first beat)
while !Task.isCancelled {
try? await Task.sleep(nanoseconds: intervalMs)
try? await Task.sleep(nanoseconds: intervalNs)
guard !Task.isCancelled else { break }
client.sendText("heartbeat")
}