Compare commits
No commits in common. "fdb575b0c1c7cb2af9aa703d9111c9ef96d4fa7f" and "178b743163f0d5a50370d7e18beb1caf3c67ba1a" have entirely different histories.
fdb575b0c1
...
178b743163
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.7.59",
|
||||
"version": "1.7.58",
|
||||
"description": "Desktop downloader",
|
||||
"main": "build/main/main/main.js",
|
||||
"author": "Sucukdeluxe",
|
||||
|
||||
@ -1215,7 +1215,6 @@ export class DownloadManager extends EventEmitter {
|
||||
private allDebridHostInfoCache = new Map<string, { info: AllDebridHostInfo; cachedAt: number }>();
|
||||
|
||||
private providerStartReservations = new Map<string, number>();
|
||||
private pacedStartReservationByItem = new Map<string, number>();
|
||||
|
||||
private lastStaleResetAt = 0;
|
||||
|
||||
@ -1716,7 +1715,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.historyRecordedPackages.clear();
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.reservedTargetPaths.clear();
|
||||
this.claimedTargetPathByItem.clear();
|
||||
@ -3399,7 +3397,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.runCompletedPackages.clear();
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.itemContributedBytes.clear();
|
||||
this.reservedTargetPaths.clear();
|
||||
@ -3508,7 +3505,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.runCompletedPackages.clear();
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.itemContributedBytes.clear();
|
||||
this.reservedTargetPaths.clear();
|
||||
@ -3621,7 +3617,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.runCompletedPackages.clear();
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.reservedTargetPaths.clear();
|
||||
this.claimedTargetPathByItem.clear();
|
||||
@ -3650,8 +3645,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.runOutcomes.clear();
|
||||
this.runCompletedPackages.clear();
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.itemContributedBytes.clear();
|
||||
this.reservedTargetPaths.clear();
|
||||
@ -3699,7 +3692,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.session.reconnectReason = "";
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.lastGlobalProgressBytes = this.session.totalDownloadedBytes;
|
||||
this.lastGlobalProgressAt = nowMs();
|
||||
@ -3812,7 +3804,6 @@ export class DownloadManager extends EventEmitter {
|
||||
this.runCompletedPackages.clear();
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.nonResumableActive = 0;
|
||||
this.session.summaryText = "";
|
||||
// Persist synchronously on shutdown to guarantee data is written before process exits
|
||||
@ -3851,7 +3842,6 @@ export class DownloadManager extends EventEmitter {
|
||||
if (wasPaused && !this.session.paused) {
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
// Reset provider circuit breaker so items don't sit in cooldown after unpause
|
||||
this.providerFailures.clear();
|
||||
|
||||
@ -5547,36 +5537,17 @@ export class DownloadManager extends EventEmitter {
|
||||
return false;
|
||||
}
|
||||
|
||||
const existingReadyAt = this.retryAfterByItem.get(item.id) || 0;
|
||||
const existingPacedAt = this.pacedStartReservationByItem.get(item.id) || 0;
|
||||
if (existingPacedAt > 0 && existingPacedAt <= now) {
|
||||
this.pacedStartReservationByItem.delete(item.id);
|
||||
return false;
|
||||
}
|
||||
if (existingPacedAt > now) {
|
||||
const scheduledAt = Math.max(existingReadyAt, existingPacedAt);
|
||||
this.retryAfterByItem.set(item.id, scheduledAt);
|
||||
item.status = "queued";
|
||||
item.speedBps = 0;
|
||||
item.fullStatus = `AllDebrid Start in ${Math.max(1, Math.ceil((scheduledAt - now) / 1000))}s`;
|
||||
item.updatedAt = now;
|
||||
return true;
|
||||
}
|
||||
|
||||
const nextAllowedAt = this.providerStartReservations.get(paceKey) || 0;
|
||||
if (nextAllowedAt <= now) {
|
||||
this.pacedStartReservationByItem.delete(item.id);
|
||||
return false;
|
||||
}
|
||||
|
||||
const existingReadyAt = this.retryAfterByItem.get(item.id) || 0;
|
||||
const scheduledAt = Math.max(existingReadyAt, nextAllowedAt);
|
||||
if (scheduledAt <= now) {
|
||||
this.pacedStartReservationByItem.delete(item.id);
|
||||
return false;
|
||||
}
|
||||
this.retryAfterByItem.set(item.id, scheduledAt);
|
||||
this.pacedStartReservationByItem.set(item.id, scheduledAt);
|
||||
this.providerStartReservations.set(paceKey, scheduledAt + ALLDEBRID_START_STAGGER_MS);
|
||||
item.status = "queued";
|
||||
item.speedBps = 0;
|
||||
item.fullStatus = `AllDebrid Start in ${Math.max(1, Math.ceil((scheduledAt - now) / 1000))}s`;
|
||||
@ -5590,12 +5561,6 @@ export class DownloadManager extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
const reservedAt = this.pacedStartReservationByItem.get(item.id) || 0;
|
||||
if (reservedAt > 0) {
|
||||
this.pacedStartReservationByItem.delete(item.id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.getProviderActiveTaskCount("alldebrid") <= 0) {
|
||||
this.providerStartReservations.delete(paceKey);
|
||||
return;
|
||||
@ -9473,7 +9438,6 @@ export class DownloadManager extends EventEmitter {
|
||||
delete this.session.items[itemId];
|
||||
this.itemCount = Math.max(0, this.itemCount - 1);
|
||||
this.retryAfterByItem.delete(itemId);
|
||||
this.pacedStartReservationByItem.delete(itemId);
|
||||
this.retryStateByItem.delete(itemId);
|
||||
if (pkg.itemIds.length === 0) {
|
||||
this.removePackageFromSession(packageId, []);
|
||||
@ -9538,7 +9502,6 @@ export class DownloadManager extends EventEmitter {
|
||||
}
|
||||
this.retryAfterByItem.clear();
|
||||
this.providerStartReservations.clear();
|
||||
this.pacedStartReservationByItem.clear();
|
||||
this.retryStateByItem.clear();
|
||||
this.reservedTargetPaths.clear();
|
||||
this.claimedTargetPathByItem.clear();
|
||||
|
||||
@ -4709,7 +4709,6 @@ describe("download manager", () => {
|
||||
{
|
||||
...defaultSettings(),
|
||||
allDebridToken: "ad-token",
|
||||
providerOrder: [],
|
||||
providerPrimary: "alldebrid",
|
||||
providerSecondary: "none",
|
||||
providerTertiary: "none",
|
||||
@ -4855,7 +4854,7 @@ describe("download manager", () => {
|
||||
res.setHeader("Accept-Ranges", "bytes");
|
||||
res.setHeader("Content-Length", String(binary.length));
|
||||
res.end(binary);
|
||||
}, 6500);
|
||||
}, 1800);
|
||||
});
|
||||
|
||||
server.listen(0, "127.0.0.1");
|
||||
@ -4904,7 +4903,6 @@ describe("download manager", () => {
|
||||
{
|
||||
...defaultSettings(),
|
||||
allDebridToken: "ad-token",
|
||||
providerOrder: [],
|
||||
providerPrimary: "alldebrid",
|
||||
providerSecondary: "none",
|
||||
providerTertiary: "none",
|
||||
@ -4932,8 +4930,9 @@ describe("download manager", () => {
|
||||
const secondDelay = readyTimes[1] - now;
|
||||
expect(firstDelay).toBeGreaterThan(1500);
|
||||
expect(firstDelay).toBeLessThan(6500);
|
||||
expect(secondDelay).toBeGreaterThan(firstDelay + 1200);
|
||||
expect(secondDelay).toBeLessThan(firstDelay + 4500);
|
||||
expect(secondDelay).toBeGreaterThan(1500);
|
||||
expect(secondDelay).toBeLessThan(6500);
|
||||
expect(Math.abs(secondDelay - firstDelay)).toBeLessThan(3500);
|
||||
|
||||
manager.stop();
|
||||
await waitFor(() => !manager.getSnapshot().session.running, 15000);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user