fix: keep large queue cancellation responsive

This commit is contained in:
Release Bot
2026-08-12 03:22:27 +02:00
parent d1b36b0aaa
commit c843b4e623
7 changed files with 43 additions and 4 deletions
+3
View File
@@ -1486,6 +1486,9 @@ setTimeout(async () => {
const historyWorkspaceLayout = await wc.executeJavaScript('(() => { const view = document.getElementById("history-view"); const sidebar = view?.querySelector(":scope > .view-sidebar"); const main = view?.querySelector(":scope > .view-main"); if (!sidebar || !main) return false; const sidebarRect = sidebar.getBoundingClientRect(); const mainRect = main.getBoundingClientRect(); return sidebarRect.width > 0 && mainRect.width > 0 && sidebarRect.right <= mainRect.left; })()');
check('History view separates sidebar and main workspace', historyWorkspaceLayout === true);
const singleRecentLinkContextLabel = await wc.executeJavaScript('(() => { selectedRecentIds.clear(); const row = document.createElement("tr"); row.dataset.order = "1001"; showRecentContextMenu(row, 8, 8); const label = document.querySelector("#recentContextMenu [data-action=recent-copy-links]")?.textContent?.trim(); hideContextMenu(); return label; })()');
check('Recent upload context menu uses singular copy text for one link', singleRecentLinkContextLabel === 'Link kopieren');
const historySidebarInformation = await wc.executeJavaScript('(() => { const sidebar = document.querySelector("#history-view > .view-sidebar")?.getBoundingClientRect(); const section = document.querySelector("#history-view .view-sidebar-section")?.getBoundingClientRect(); const retention = document.getElementById("historySidebarRetention")?.textContent?.trim(); return Boolean(sidebar && section && section.top >= sidebar.top + sidebar.height * 0.55 && retention === "Alles behalten"); })()');
check('History sidebar shows the active retention in its lower area', historySidebarInformation === true);
+33
View File
@@ -225,6 +225,39 @@ describe('UploadManager', () => {
assert.ok(batchDone, 'batch-done should be emitted even after cancel');
});
it('does not emit one aborted progress event per job when cancelling a whole batch', async () => {
mockUploadFile.mock.mockImplementation(async (hoster, filePath, apiKey, onProgress, signal) => {
await new Promise((resolve, reject) => {
const timer = setTimeout(resolve, 10000);
signal.addEventListener('abort', () => {
clearTimeout(timer);
reject(new Error('Aborted'));
}, { once: true });
});
return { download_url: `https://${hoster}/d/ok123`, embed_url: null, file_code: 'ok123' };
});
const mgr = new UploadManager({
'doodstream.com': { retries: 0, parallelCount: 1, maxSpeedKbs: 0, restartBelowKbs: 0, timeIntervalSec: 0, maxSizeMb: 0 }
});
const statuses = [];
mgr.on('progress', (data) => statuses.push(data.status));
const tasks = Array.from({ length: 60 }, (_, index) => ({
jobId: `cancel-${index}`,
file: `/test/cancel-${index}.mp4`,
hoster: 'doodstream.com',
apiKey: 'key1'
}));
const batchPromise = mgr.startBatch(tasks);
await new Promise((resolve) => setTimeout(resolve, 50));
mgr.cancel();
await batchPromise;
assert.equal(statuses.filter((status) => status === 'aborted').length, 0);
});
it('maxSizeMb filter skips oversized files', async () => {
fakeFileSize = 5 * 1024 * 1024; // 5 MB