Show batch progress in footer: '📡 50/630 relays · 2/25 batches · relay.example.com'
This commit is contained in:
@@ -393,6 +393,8 @@ function handleWorkerMessage(event) {
|
||||
latestRelay: message.latestRelay,
|
||||
latestError: message.latestError,
|
||||
relayUrls: message.relayUrls || [],
|
||||
batchCurrent: message.batchCurrent,
|
||||
batchTotal: message.batchTotal,
|
||||
}
|
||||
}));
|
||||
} else if (message.type === 'startupStatus') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"VERSION": "v0.7.78",
|
||||
"VERSION_NUMBER": "0.7.78",
|
||||
"BUILD_DATE": "2026-06-30T14:33:14.964Z"
|
||||
"VERSION": "v0.7.79",
|
||||
"VERSION_NUMBER": "0.7.79",
|
||||
"BUILD_DATE": "2026-06-30T14:36:42.724Z"
|
||||
}
|
||||
|
||||
@@ -6322,7 +6322,21 @@ async function handlePublish(requestId, event, port) {
|
||||
for (let i = 0; i < broadcastOnlyUrls.length; i += BATCH_SIZE) {
|
||||
batches.push(broadcastOnlyUrls.slice(i, i + BATCH_SIZE));
|
||||
}
|
||||
console.log(`[Worker] Phase 2: Broadcasting to ${broadcastOnlyUrls.length} relays in ${batches.length} batches of ${BATCH_SIZE}`);
|
||||
const totalBatches = batches.length;
|
||||
console.log(`[Worker] Phase 2: Broadcasting to ${broadcastOnlyUrls.length} relays in ${totalBatches} batches of ${BATCH_SIZE}`);
|
||||
|
||||
// Emit a progress event showing batch info before starting batches.
|
||||
broadcast({
|
||||
type: 'broadcastProgress',
|
||||
sessionId: publishSessionId,
|
||||
phase: 'progress',
|
||||
total: totalTarget,
|
||||
successful: publishedSoFar.size,
|
||||
failed: failedSoFar.size + timedOutSoFar.size,
|
||||
latestRelay: null,
|
||||
batchCurrent: 0,
|
||||
batchTotal: totalBatches,
|
||||
});
|
||||
|
||||
for (let bi = 0; bi < batches.length; bi++) {
|
||||
const batch = batches[bi];
|
||||
@@ -6341,7 +6355,19 @@ async function handlePublish(requestId, event, port) {
|
||||
} catch (batchErr) {
|
||||
// Expected — some relays in this batch may fail.
|
||||
}
|
||||
console.log(`[Worker] Batch ${bi + 1}/${batches.length} complete — ` +
|
||||
// Emit a progress event with batch info after each batch.
|
||||
broadcast({
|
||||
type: 'broadcastProgress',
|
||||
sessionId: publishSessionId,
|
||||
phase: 'progress',
|
||||
total: totalTarget,
|
||||
successful: publishedSoFar.size,
|
||||
failed: failedSoFar.size + timedOutSoFar.size,
|
||||
latestRelay: null,
|
||||
batchCurrent: bi + 1,
|
||||
batchTotal: totalBatches,
|
||||
});
|
||||
console.log(`[Worker] Batch ${bi + 1}/${totalBatches} complete — ` +
|
||||
`${publishedSoFar.size}/${totalTarget} total succeeded, ` +
|
||||
`${failedSoFar.size + timedOutSoFar.size} failed/timeout so far`);
|
||||
}
|
||||
|
||||
@@ -831,7 +831,11 @@ import { initPostCards } from './js/post-interactions2.mjs';
|
||||
const shortRelay = d.latestRelay
|
||||
? d.latestRelay.replace(/^wss?:\/\//, '').replace(/\/.*$/, '').slice(0, 30)
|
||||
: '';
|
||||
spanBroadcastStatus.textContent = `📡 ${d.successful}/${d.total} relays · ${shortRelay}`;
|
||||
const batchInfo = (d.batchTotal && d.batchTotal > 0)
|
||||
? ` · ${d.batchCurrent}/${d.batchTotal} batches`
|
||||
: '';
|
||||
const relayInfo = shortRelay ? ` · ${shortRelay}` : '';
|
||||
spanBroadcastStatus.textContent = `📡 ${d.successful}/${d.total} relays${batchInfo}${relayInfo}`;
|
||||
} else if (d.phase === 'done') {
|
||||
// Keep the result displayed until the next publish overwrites it.
|
||||
spanBroadcastStatus.textContent = `✅ ${d.successful}/${d.total} relays` + (d.failed > 0 ? ` (${d.failed} failed)` : '');
|
||||
|
||||
Reference in New Issue
Block a user