From be86634a65ca77ffc53b37008117ae095d2ab674 Mon Sep 17 00:00:00 2001 From: Gigi Date: Thu, 9 Oct 2025 14:00:57 +0100 Subject: [PATCH] fix: skip rebroadcasting when in flight mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Check actual relay connectivity before rebroadcasting - Skip rebroadcast to all relays if no remote relays connected - Still allows rebroadcast to local relays in flight mode - Prevents unnecessary publish attempts to unreachable relays - Logs: '✈️ Flight mode: skipping rebroadcast to remote relays' This prevents the app from trying to rebroadcast fetched events to remote relays when only local relays are connected (flight mode). --- src/services/rebroadcastService.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/services/rebroadcastService.ts b/src/services/rebroadcastService.ts index ac9bd5dd..6cce16b6 100644 --- a/src/services/rebroadcastService.ts +++ b/src/services/rebroadcastService.ts @@ -27,11 +27,22 @@ export async function rebroadcastEvents( return // No rebroadcast enabled } + // Check current relay connectivity - don't rebroadcast in flight mode + const connectedRelays = Array.from(relayPool.relays.values()) + const connectedRemoteRelays = connectedRelays.filter(relay => relay.connected && !isLocalRelay(relay.url)) + const hasRemoteConnection = connectedRemoteRelays.length > 0 + + // If we're in flight mode (only local relays connected) and user wants to broadcast to all relays, skip + if (broadcastToAll && !hasRemoteConnection) { + console.log('✈️ Flight mode: skipping rebroadcast to remote relays') + return + } + // Determine target relays based on settings let targetRelays: string[] = [] if (broadcastToAll) { - // Broadcast to all relays + // Broadcast to all relays (only if we have remote connection) targetRelays = RELAYS } else if (useLocalCache) { // Only broadcast to local relays