Keep session bytes on live update cadence

This commit is contained in:
Sucukdeluxe
2026-08-31 15:56:04 +02:00
parent 9ca5789627
commit 1580a160da
4 changed files with 32 additions and 4 deletions
+19
View File
@@ -84,6 +84,25 @@ describe("download live update cadence", () => {
vi.useRealTimers();
}
});
it("keeps the session byte counter live while large-queue statistics are cached", () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), "rd-live-session-bytes-"));
tempDirs.push(root);
const session = emptySession();
session.running = true;
const manager = new DownloadManager(defaultSettings(), session, createStoragePaths(path.join(root, "state")));
const internal = manager as unknown as {
itemCount: number;
sessionDownloadedBytes: number;
};
internal.itemCount = 500;
internal.sessionDownloadedBytes = 8 * 1024 * 1024;
expect(manager.getSnapshot().stats.totalDownloaded).toBe(8 * 1024 * 1024);
internal.sessionDownloadedBytes = 16 * 1024 * 1024;
expect(manager.getSnapshot().stats.totalDownloaded).toBe(16 * 1024 * 1024);
});
});
describe("snapshot revision", () => {