🐛 fix: health check wait timeout, _deletedJobIds memory cleanup

- Add 30-second timeout to health check wait loop in startUpload/
  startSelectedUpload to prevent infinite spin if healthCheckRunning
  gets stuck
- Clear _deletedJobIds Set when batch completes to prevent unbounded
  memory growth over long sessions with many deletions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Administrator 2026-03-21 14:16:59 +01:00
parent ffc8fb4026
commit ada3b31ad1

View File

@ -1315,7 +1315,7 @@ function getSelectedJobLinks() {
async function startUpload() { async function startUpload() {
if (uploading) return; if (uploading) return;
// Wait for any running health check to finish (e.g. startup auto-check) // Wait for any running health check to finish (e.g. startup auto-check)
while (healthCheckRunning) await new Promise(r => setTimeout(r, 100)); for (let _hcWait = 0; healthCheckRunning && _hcWait < 300; _hcWait++) await new Promise(r => setTimeout(r, 100)); // max 30s
uploading = true; // set immediately to prevent double-click race uploading = true; // set immediately to prevent double-click race
updateQueueActionButtons(); updateQueueActionButtons();
@ -1386,7 +1386,7 @@ async function startUpload() {
async function startSelectedUpload() { async function startSelectedUpload() {
if (uploading) return; if (uploading) return;
while (healthCheckRunning) await new Promise(r => setTimeout(r, 100)); for (let _hcWait = 0; healthCheckRunning && _hcWait < 300; _hcWait++) await new Promise(r => setTimeout(r, 100)); // max 30s
uploading = true; // set immediately to prevent double-click race uploading = true; // set immediately to prevent double-click race
updateQueueActionButtons(); updateQueueActionButtons();
@ -1567,6 +1567,7 @@ function handleProgress(data) {
function handleBatchDone(summary) { function handleBatchDone(summary) {
uploading = false; uploading = false;
applySummaryResults(summary); applySummaryResults(summary);
_deletedJobIds.clear(); // Free memory — stale IDs no longer needed after batch completes
// Reset aborted jobs back to queued so they can be restarted // Reset aborted jobs back to queued so they can be restarted
for (const job of queueJobs) { for (const job of queueJobs) {