From d04844cce878a5da1a778d8e8bf9ee0908dca32a Mon Sep 17 00:00:00 2001 From: Laan Tungir Date: Tue, 30 Jun 2026 11:24:45 -0400 Subject: [PATCH] Detect silent relay failures: after each batch, mark relays with no response as timed out (catches DNS errors, connection refused, HTTP handshake failures that NDK doesn't emit relay:publish:failed for) --- www/js/version.json | 6 +++--- www/ndk-worker.js | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/www/js/version.json b/www/js/version.json index e59584b..222e4d0 100644 --- a/www/js/version.json +++ b/www/js/version.json @@ -1,5 +1,5 @@ { - "VERSION": "v0.7.82", - "VERSION_NUMBER": "0.7.82", - "BUILD_DATE": "2026-06-30T15:07:27.716Z" + "VERSION": "v0.7.83", + "VERSION_NUMBER": "0.7.83", + "BUILD_DATE": "2026-06-30T15:24:45.710Z" } diff --git a/www/ndk-worker.js b/www/ndk-worker.js index d6f43ee..d7b4c20 100644 --- a/www/ndk-worker.js +++ b/www/ndk-worker.js @@ -6373,6 +6373,19 @@ async function handlePublish(requestId, event, port) { } catch (batchErr) { // Expected — some relays in this batch may fail. } + // --- Detect silent failures --- + // NDK's relay.publish() can resolve false without emitting + // relay:publish:failed (e.g., DNS errors, connection refused, + // HTTP handshake failures). These relays are not in any of + // our tracked sets. Mark them as timed out so they get + // skip-marked and don't waste time on the next publish. + for (const url of batch) { + if (!publishedSoFar.has(url) && !failedSoFar.has(url) && !timedOutSoFar.has(url)) { + timedOutSoFar.add(url); + const elapsed = ((Date.now() - publishStartTime) / 1000).toFixed(1); + console.log(`[Worker][broadcast] ⏱️ ${url} SILENT TIMEOUT (${elapsed}s) — batch ${currentBatch}/${totalBatches} (no response, likely connection failure)`); + } + } // Emit a progress event with batch info after each batch. broadcast({ type: 'broadcastProgress',